Friday, March 28, 2014

SharePoint workflow deployment issue: Error occurred in deployment step ‘Activate Features’, Unable to locate workflow association data

While deploying with SharePoint workflow I got an error saying that “Error occurred in deployment step 'Activate Features': Unable to locate the workflow's association data. To restore the association data to the workflow, restart the workflow settings wizard by selecting the workflow node in Solution Explorer and then clicking the ellipsis button (…) on one of the properties in the Properties window that has an ellipsis button”

Workflow is combination of events like task creation, Task updating and completion. By adding a workflow to the site, we have to specify the task list and history lists. Instances of task list and history list will track the events for workflow. Task list allows users to interact with workflow and history list contains information about the workflow events including date, status, participant etc.

While creating a new workflow visual studio will associate the lists. Some cases association will goes away whenever we change or delete the workflow designer file, we can get association error. To fix this error we have to set “Auto Associate” property to ‘false’ in workflow properties.



 By deploying the workflow now workflow will deploy without any issues and user will manually go and create the associations instead of automatic associations.


Wednesday, March 26, 2014

SharePoint 2013 – Not able to see “Audit log reports” link in Site settings

In one of my previous article I have explained how to configure audit log reports in SharePoint environment. I got few comments that they are not able to see the “Audit log reports” link in site settings

By activating reporting feature we can add “Audit log reports” link to site settings. We can add “Audit log reports” link in site settings by using following steps

Navigate to SharePoint site settings page and click on Manage Site collection features in Site Administration section



Check for Reporting feature. Click on activate button to activate the feature.



Now we can Audit log reports link in Site Collection Administration section as shown below.


Monday, March 24, 2014

Upgrade workflow in SharePoint environment

While working with SharePoint workflows I have a scenario to upgrade the logic for workflow. But there are many items already running on the existing workflow. So new workflow shouldn’t override on existing. We need to create an upgrade for existing workflow.

TO do that we have to follow the steps below,
Change Workflow assembly version number by right clicking on the workflow project, In Application section, Click on Assembly Info button. Change Assembly Version number and file version number in Assembly information























Update the assembly version number in workflow.xml file workflow element. Change the Solution ID in the manifest.xml file

Change .wsp name. For example we have Site.DataRequestWorkFlow.wsp previously, update it to Site.DataRequestWorkflowV1.wsp.

Deploy new wsp file using PowerShell commands or stsadm commands and we have to Run IISReset command


Change the old workflow to not allowing any new instances and disable the options to start manually or Item created. By doing this there will not any new instances for old workflow. Create a new workflow association using new workflow that deployed.

Tuesday, March 18, 2014

Upgrade SharePoint 2010 classic mode web application to SharePoint 2013 claims mode using PowerShell commands

While working with SharePoint 2010 to 2013 migration I have to migrate SharePoint 2010 classic mode 2013 claims mode because we don’t have classic mode in SharePoint 2013. To do that I have upgraded SharePoint 2010 site to use claims mode authentication using PowerShell commands and restored the DB in SP 2013 server.

Now I ran: Test-SPContentDatabase” command to check the upgrade status. I got an error saying that there is inconsistency between the authentication modes. So I have reverted the claims mode authentication web app to classic mode and created a Web application in SharePoint 2013 using classic mode using following command

New-SPWebApplication -Name "Web application name" -ApplicationPool " Web application AppPool" -AuthenticationMethod "NTLM" -ApplicationPoolAccount (Get-SPManagedAccount "Application Pool account") -Port Port Number -URL "URL of the web application"

Now I took the classic mode SP 2010 web application backup and restored in SP 2013 web application. By running “Test-SPContentDatabase” command I got no issues. Now mount the database using “Mount-SPContentDatabase” command

Mount-SPContentDatabase ContentDB Name -DatabaseServer DBServerName -WebApplication Web Application URL

Finally we have to convert the web application from classic mode to claimant mode by using “Convert-SPWebApplication” command

Convert-SPWebApplication -Identity "WebApp URL" -To Claims –RetainPermissions -Force

Monday, March 17, 2014

Update UserProfile properties in using SPServices in SharePoint

I got a requirement to update the User Profile properties for one of my client. We have only option to do that using SPServices because they are not allowing any server side code. In SPServices we can directly update the user profile services using “ModifyUserPropertyByAccountName” method. By passing current logged-in user account to the method we can update the user profile properties using SPServices. I have found the following code from here (http://azzu-sheikh.blogspot.in/2014/01/update-user-profile-property-through.html)to update the user profile service.

function updateUserProfileProperty(currentLoggedInUser, propertyName, propertyValue) {
   var propertyData = "<PropertyData>" +
  "<IsPrivacyChanged>false</IsPrivacyChanged>" +
  "<IsValueChanged>true</IsValueChanged>" +
  "<Name>" + propertyName + "</Name>" +
  "<Privacy>NotSet</Privacy>" +
  "<Values><ValueData><Value xsi:type=\"xsd:string\">" + propertyValue + "</Value></ValueData></Values>" +
  "</PropertyData>";

   $().SPServices({
       operation: "ModifyUserPropertyByAccountName",
       async: false,
       webURL: "/",
       accountName: currentLoggedInUser,
       newData: propertyData,
       completefunc: function (xData, Status) {
           var result = $(xData.responseXML);
           if (Status == "success") {
              //do update action
           }
       }
   });
}


We can change the user property details by getting property data in to the method and passing the current logged-in user account details as shown the code above.