Archive | April 2013

Configure a Sharepoint 2013 Dev VM to Workflows

SharePoint 2013 supports two Workflow plataforms, one for SharePoint 2010 WFs and another for SharePoint 2013 Wfs.

The 2010 plataform is installed by default with SharePoint 2013.

To work with 2013 workflows, you need to install the workflow manager.

When you finish this setup, you have to decide if you prefer to do the configurations with the wizard, or if you prefer with power shell.

If you prefer power shell, you have a button, in the wizard, to get power shell commands.

You need to change this power shell script with your key, and run it:

# To be run in Workflow Manager PowerShell console that has both Workflow Manager and Service Bus installed.

# Create new SB Farm $SBCertificateAutoGenerationKey = ConvertTo-SecureString -AsPlainText  -Force  -String ‘***** Replace with Service Bus Certificate Auto-generation key ******’ -Verbose;

New-SBFarm -SBFarmDBConnectionString ‘Data Source=WIN-UOLELEUK31P\SHAREPOINT;Initial Catalog=SbManagementDB;Integrated Security=True;Encrypt=False’ -InternalPortRangeStart 9000 -TcpPort 9354 -MessageBrokerPort 9356 -RunAsAccount ‘Administrator’ -AdminGroup ‘BUILTIN\Administrators’ -GatewayDBConnectionString ‘Data Source=WIN-UOLELEUK31P\SHAREPOINT;Initial Catalog=SbGatewayDatabase;Integrated Security=True;Encrypt=False’ -CertificateAutoGenerationKey $SBCertificateAutoGenerationKey -MessageContainerDBConnectionString ‘Data Source=WIN-UOLELEUK31P\SHAREPOINT;Initial Catalog=SBMessageContainer01;Integrated Security=True;Encrypt=False’ -Verbose;

# To be run in Workflow Manager PowerShell console that has both Workflow Manager and Service Bus installed.

# Create new WF Farm $WFCertAutoGenerationKey = ConvertTo-SecureString -AsPlainText  -Force  -String ‘***** Replace with Workflow Manager Certificate Auto-generation key ******’ -Verbose;

New-WFFarm -WFFarmDBConnectionString ‘Data Source=WIN-UOLELEUK31P\SHAREPOINT;Initial Catalog=WFManagementDB;Integrated Security=True;Encrypt=False’ -RunAsAccount ‘Administrator’ -AdminGroup ‘BUILTIN\Administrators’ -HttpsPort 12290 -HttpPort 12291 -InstanceDBConnectionString ‘Data Source=WIN-UOLELEUK31P\SHAREPOINT;Initial Catalog=WFInstanceManagementDB;Integrated Security=True;Encrypt=False’ -ResourceDBConnectionString ‘Data Source=WIN-UOLELEUK31P\SHAREPOINT;Initial Catalog=WFResourceManagementDB;Integrated Security=True;Encrypt=False’ -CertificateAutoGenerationKey $WFCertAutoGenerationKey -Verbose;

# Add SB Host $SBRunAsPassword = ConvertTo-SecureString -AsPlainText  -Force  -String ‘***** Replace with RunAs Password for Service Bus ******’ -Verbose;

Add-SBHost -SBFarmDBConnectionString ‘Data Source=WIN-UOLELEUK31P\SHAREPOINT;Initial Catalog=SbManagementDB;Integrated Security=True;Encrypt=False’ -RunAsPassword $SBRunAsPassword -EnableFirewallRules $true -CertificateAutoGenerationKey $SBCertificateAutoGenerationKey -Verbose;

Try {     # Create new SB Namespace     New-SBNamespace -Name ‘WorkflowDefaultNamespace’ -AddressingScheme ‘Path’ -ManageUsers ‘Administrator’,’Administrator’ -Verbose;

Start-Sleep -s 90 } Catch [system.InvalidOperationException] { }

# Get SB Client Configuration $SBClientConfiguration = Get-SBClientConfiguration -Namespaces ‘WorkflowDefaultNamespace’ -Verbose;

# Add WF Host $WFRunAsPassword = ConvertTo-SecureString -AsPlainText  -Force  -String ‘***** Replace with RunAs Password for Workflow Manager ******’ -Verbose;

Add-WFHost -WFFarmDBConnectionString ‘Data Source=WIN-UOLELEUK31P\SHAREPOINT;Initial Catalog=WFManagementDB;Integrated Security=True;Encrypt=False’ -RunAsPassword $WFRunAsPassword -EnableFirewallRules $true -SBClientConfiguration $SBClientConfiguration -EnableHttpPort  -CertificateAutoGenerationKey $WFCertAutoGenerationKey -Verbose;

After this you can run inetmgr and see in the iis the new site for WF Manager services.

If there is no http binding, configure that to port 12291, this can happen if you didn’t select http enabled in the installation wizard.

wf

After that, you have to configure your communications using http:

Register-SPWorkflowService –SPSite “http://myserver/mysitecollection” –WorkflowHostUri “http://workflow.example.com:12291” –AllowOAuthHttp

Or https:

Register-SPWorkflowService –SPSite “https://myserver/mysitecollection” –WorkflowHostUri https://workflow.example.com:12290

References: http://technet.microsoft.com/en-us/library/jj658588.aspx#section4

Advertisements

Sharepoint 2013 Create a Master Page based on Seattle.master with VS 2012

Create a new project:

Branding

Configure as a Sandbox Solution:

Branding1

Add a new Module to your project:

Branding2

Download a copy of Seattle.master:

Branding3

Add the copy to your module, rename to CustomMaster.master, and Change your elements.xml file to point to _catalogs\masterpage folder:

Branding4

Change your masterpage, to include a welcome message:

Branding7

Deploy your solution and change your Site master page:

Branding5

Verify that it shows your welcome message:

Branding6

Sharepoint 2013 Create a Visual Web Part

In Visual Studio 2012, create a new SharePoint 2013 Empty Project:

app1

Choose your dev SharePoint Site and deploy as a farm solution:

Add a Visual Web Part item to your project:

app3

Edit your Visual Web Part, and insert a calendar and a label(choose from toolbox):

app4

Define the calendar’s selected date changed event, by double clicking any date in your calendar, and change the event code:

protectedvoid Calendar1_SelectionChanged(object sender, EventArgs e)

{

this.Label1.Text = Calendar1.SelectedDate.ToString();

}

Deploy your solution, and add the Visual Webpart to your Home page:

app5

Windbg – analyze a framework 4.0 exception Dump

Open windbg, if the dump is from a 64 bits plataforma use windbg 64 bits.

Go to windbg menu File/Open Crash Dump, and choose your dump file.

Load the clr.dll, this should be in the same version that it is in the plataform, from where you took your dump.

!load C:\Windows\Microsoft.NET\Framework64\v4.0.30319\clr.dll

Load the psscor4.dll, you can download this dll from (http://www.microsoft.com/en-us/download/details.aspx?id=21255), be sure of the version 64 vs x86:

!load G:\Psscor4\Psscor4\amd64\amd64\psscor4.dll

Now you can access the Stack of your exception, using (!ClrStack), this command can have other parameters, if you use (!ClrStack -a), you can see the parameters in each call.

To print the value of any of those parameters, you can use (!do <parameter adress>)

0:008> !ClrStack

OS Thread Id: 0x2a8 (8) Child SP         IP               Call Site 0000000001e9a978 000007fefda8a49d [HelperMethodFrame_PROTECTOBJ: 0000000001e9a978] System.Reflection.RuntimeAssembly._nLoad(System.Reflection.AssemblyName, System.String, System.Security.Policy.Evidence, System.Reflection.RuntimeAssembly, System.Threading.StackCrawlMark ByRef, Boolean, Boolean, Boolean) 0000000001e9ab50 000007fef5bd0117 System.Reflection.RuntimeAssembly.InternalLoadAssemblyName(System.Reflection.AssemblyName, System.Security.Policy.Evidence, System.Threading.StackCrawlMark ByRef, Boolean, Boolean)*** WARNING: Unable to verify checksum for mscorlib.ni.dll

0000000001e9abf0 000007fef5bb44f0 System.Reflection.RuntimeAssembly.InternalLoadFrom(System.String, System.Security.Policy.Evidence, Byte[], System.Configuration.Assemblies.AssemblyHashAlgorithm, Boolean, Boolean, System.Threading.StackCrawlMark ByRef) 0000000001e9ac50 000007fef5bb729d System.Reflection.Assembly.LoadFrom(System.String) 0000000001e9acb0 000007ff0020079a WebActivator.ActivationManager.get_Assemblies()*** WARNING: Unable to verify checksum for WebActivator.dll *** ERROR: Module load completed but symbols could not be loaded for WebActivator.dll

0000000001e9ad80 000007ff00200278 WebActivator.ActivationManager.RunActivationMethods[[System.__Canon, mscorlib]]() 0000000001e9ae90 000007ff00200206 WebActivator.ActivationManager.RunPreStartMethods() 0000000001e9aec0 000007ff00200158 WebActivator.ActivationManager.Run() 0000000001e9b598 000007fef6c210b4 [DebuggerU2MCatchHandlerFrame: 0000000001e9b598] 0000000001e9b680 000007fef6c210b4 [CustomGCFrame: 0000000001e9b680] 0000000001e9b648 000007fef6c210b4 [GCFrame: 0000000001e9b648] 0000000001e9b5d8 000007fef6c210b4 [GCFrame: 0000000001e9b5d8] 0000000001e9b9a8 000007fef6c210b4 [HelperMethodFrame_PROTECTOBJ: 0000000001e9b9a8] System.RuntimeMethodHandle._InvokeMethodFast(System.IRuntimeMethodInfo, System.Object, System.Object[], System.SignatureStruct ByRef, System.Reflection.MethodAttributes, System.RuntimeType) 0000000001e9baf0 000007fef5bc5cb8 System.RuntimeMethodHandle.InvokeMethodFast(System.IRuntimeMethodInfo, System.Object, System.Object[], System.Signature, System.Reflection.MethodAttributes, System.RuntimeType) 0000000001e9bbe0 000007fef5bc5789 System.Reflection.RuntimeMethodInfo.Invoke(System.Object, System.Reflection.BindingFlags, System.Reflection.Binder, System.Object[], System.Globalization.CultureInfo, Boolean) 0000000001e9bd20 000007fef5c10426 System.Reflection.RuntimeMethodInfo.Invoke(System.Object, System.Reflection.BindingFlags, System.Reflection.Binder, System.Object[], System.Globalization.CultureInfo) 0000000001e9bd70 000007fee2c4fe77 System.Web.Compilation.BuildManager.InvokePreStartInitMethods(System.Collections.Generic.ICollection`1<System.Reflection.MethodInfo>)*** WARNING: Unable to verify checksum for System.Web.ni.dll

0000000001e9be30 000007fee2c4f9e1 System.Web.Compilation.BuildManager.CallPreStartInitMethods() 0000000001e9bea0 000007fee2c4210f System.Web.Hosting.HostingEnvironment.Initialize(System.Web.Hosting.ApplicationManager, System.Web.Hosting.IApplicationHost, System.Web.Configuration.IConfigMapPathFactory, System.Web.Hosting.HostingEnvironmentParameters, System.Security.Policy.PolicyLevel, System.Exception) 0000000001e9bf20 000007fee2c41cc6 System.Web.Hosting.HostingEnvironment.Initialize(System.Web.Hosting.ApplicationManager, System.Web.Hosting.IApplicationHost, System.Web.Configuration.IConfigMapPathFactory, System.Web.Hosting.HostingEnvironmentParameters, System.Security.Policy.PolicyLevel) 0000000001e9c398 000007fef6c210b4 [GCFrame: 0000000001e9c398] 0000000001e9c3d0 000007fef6c210b4 [GCFrame: 0000000001e9c3d0] 0000000001e9c608 000007fef6c210b4 [ContextTransitionFrame: 0000000001e9c608] 0000000001e9c8a0 000007fef6c210b4 [GCFrame: 0000000001e9c8a0] 0000000001e9c8d8 000007fef6c210b4 [GCFrame: 0000000001e9c8d8] 0000000001e9e1f8 000007fef6c210b4 [CustomGCFrame: 0000000001e9e1f8] 0000000001e9e220 000007fef6c210b4 [CustomGCFrame: 0000000001e9e220] 0000000001e9e248 000007fef6c210b4 [CustomGCFrame: 0000000001e9e248] 0000000001e9e270 000007fef6c210b4 [CustomGCFrame: 0000000001e9e270] 0000000001e9e298 000007fef6c210b4 [CustomGCFrame: 0000000001e9e298] 0000000001e9e2c0 000007fef6c210b4 [CustomGCFrame: 0000000001e9e2c0] 0000000001e9e2e8 000007fef6c210b4 [CustomGCFrame: 0000000001e9e2e8] 0000000001e9e8e8 000007fef6c210b4 [TPMethodFrame: 0000000001e9e8e8] System.Web.Hosting.HostingEnvironment.Initialize(System.Web.Hosting.ApplicationManager, System.Web.Hosting.IApplicationHost, System.Web.Configuration.IConfigMapPathFactory, System.Web.Hosting.HostingEnvironmentParameters, System.Security.Policy.PolicyLevel) 0000000001e9e950 000007fee2c40b54 System.Web.Hosting.ApplicationManager.CreateAppDomainWithHostingEnvironment(System.String, System.Web.Hosting.IApplicationHost, System.Web.Hosting.HostingEnvironmentParameters) 0000000001e9eb60 000007fee2c3faa5 System.Web.Hosting.ApplicationManager.CreateAppDomainWithHostingEnvironmentAndReportErrors(System.String, System.Web.Hosting.IApplicationHost, System.Web.Hosting.HostingEnvironmentParameters) 0000000001e9ebc0 000007fee2c3fa22 System.Web.Hosting.ApplicationManager.GetAppDomainWithHostingEnvironment(System.String, System.Web.Hosting.IApplicationHost, System.Web.Hosting.HostingEnvironmentParameters) 0000000001e9ec30 000007fee2c3f938 System.Web.Hosting.ApplicationManager.CreateObjectInternal(System.String, System.Type, System.Web.Hosting.IApplicationHost, Boolean, System.Web.Hosting.HostingEnvironmentParameters) 0000000001e9ec90 000007fee33a592a System.Web.Hosting.ProcessHost.StartApplication(System.String, System.String, System.Object ByRef) 0000000001e9ed40 000007fee33f2972 DomainNeutralILStubClass.IL_STUB_COMtoCLR(IntPtr, IntPtr, IntPtr ByRef) 0000000001e9f138 000007fef6c8e93e [GCFrame: 0000000001e9f138] 0000000001e9f320 000007fef6c8e93e [ComMethodFrame: 0000000001e9f320]

Sharepoint 2013 Project Functionality

In SharePoint 2013, if you activate the site feature, Project Functionality, it’ll add a task web part to your homepage and will create a calendar and a task list.

Project Functionality

This feature adds project management functionality to a site. It includes tasks, a calendar, and web parts on the home page of the site. 

Sharepoint 2013 – Create an AppPart Sharepoint Hosted

Create a Visual Studio 2012 “App for SharePoint 2013” Project:

app1

Enter your SharePoint url and select the “SharePoint hosted” option:

app2

Add a “Client Web Part Item” to your project:

app3

Select the option “Create a New Client Web Part Page”:

app4

Change the SampleWebPart.aspx to include a label:

app5

Create a SampleWebPart.js file, in the Scripts folder, and  include the script:

‘use strict’;
var context = SP.ClientContext.get_current();

var web = context.get_web();

$(document).ready(function () {

    getWebTitle();

});

function getWebTitle() {

    context.load(web, “Title”);

    context.executeQueryAsync(onGetWebSuccess, onGetWebFail)

}

function onGetWebSuccess() {

  
    $(‘#webTitle’).text(‘Welcome to ‘ + web.get_title());

}

function onGetWebFail(sender, args) {

    $(‘#webTitle’).text(‘Error ‘);

}

Change the SampleWebPart.aspx to include the new script file:

<script type=”text/javascript”src=”../Scripts/SampleWebPart.js”></script>

Edit the AppManifest.xml file to define app permissions:

app8

Deploy your project, and add the webpart to your homepage:

app7

Configure a Dev VM to Sharepoint 2013 Apps

To configure a SharePoint 2013 environment to deploy Shaprepoint 2013 apps, you can follow this article http://technet.microsoft.com/en-us/library/fp161236.aspx. If, you don’t have any domain controller, you can configure your app domain on your hosts file (c:/windows/system32/drivers/etc) and need to DisableLoopbackCheck.