Showing posts with label SharePoint 2013. Show all posts
Showing posts with label SharePoint 2013. Show all posts

SharePoint Web Services Error : An item with the same key has already been added

Hi There,


Recently i found that none of my SharePoint 2013 application services are working. Crashing and throwing unknown multiple kind of errors in event viewer. One of the famous error that i found was below with Event ID 3.

[code]WebHost failed to process a request. Sender Information: System.ServiceModel.Activation.HostedHttpRequestAsyncResult/47208365 Exception: System.ArgumentException: An item with the same key has already been added. at System.Runtime.AsyncResult.End[TAsyncResult](IAsyncResult result) at System.ServiceModel.Activation.HostedHttpRequestAsyncResult.End(IAsyncResult result) Process Name: w3wp Process ID: 12724 [/code]


While troubleshooting i noticed that none of SharePoint Web Services are browsing and crashing with below error. I knew that it isn't any SharePoint specific error so i tried to recall the changes i have done on server.

Server Error in '/925bc7e108ff47198283782382a09c0d' Application.


An item with the same key has already been added.
Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.

Exception Details: System.ArgumentException: An item with the same key has already been added.

Source Error: 
An unhandled exception was generated during the execution of the current web request. Information regarding the origin and location of the exception can be identified using the exception stack trace below.

Stack Trace: 

[ArgumentException: An item with the same key has already been added.]
   System.Runtime.AsyncResult.End(IAsyncResult result) +622882
   System.ServiceModel.Activation.HostedHttpRequestAsyncResult.End(IAsyncResult result) +196075
   System.Web.AsyncEventExecutionStep.OnAsyncEventCompletion(IAsyncResult ar) +166




Version Information: Microsoft .NET Framework Version:4.0.30319; ASP.NET Version:4.0.30319.33440




Resolution:

I noticed that somehow during troubleshooting of some other bug i removed the HTTPS bindings from IIS for SharePoint Web Services on Port 32844 which is must even if its not being used by SharePoint. I ran the below Command Prompt command and boom. The services are back.


[code]appcmd set site /site.name:"SharePoint Web Services" /+bindings.[protocol='https',bindingInformation='*:32844:'][/code]





Hope it help someone.

Happy SharePointing...!

Could not load file or assembly 'Microsoft.Workflow.Client

Could not load file or assembly 'Microsoft.Workflow.Client

This issue was really a headache for me today. In my farm of four servers i have 2 WFE and 2 APP servers (of course a DB server separately). I have configured Workflow Manager on 1 APP server and Workflow Manager Client on all of the remaining servers. Suddenly i started getting error on workflows and the GUID lead me to the below ULS logs of SharePoint.

[code]07/15/2016 23:28:06.77 w3wp.exe (0x0E40) 0x2B54 SharePoint Foundation Logging Correlation Data xmnv Medium Name=Request (GET:http://mysharepointapplication:80/newsite/test/_layouts/15/Workflow.aspx?ID=20&List=%7B18957A04-11A4-4016-9404-B1D3897619EF%7D&Source=http%3A%2F%2Fmysharepointapplication%2Fit%2Fsystems%2Fsystems%2Ftest%2FLists%2FCustom%2520List%2FAllItems%2Easpx%3FInitialTabId%3DRibbon%252ERead%26VisibilityContext%3DWSSTabPersistence) da1f909d-545f-60b2-1cdd-8923ed950a7a 07/15/2016 23:28:06.77 w3wp.exe (0x0E40) 0x2B54 SharePoint Foundation Authentication Authorization agb9s Medium Non-OAuth request. IsAuthenticated=True, UserIdentityName=0#.w|mydomain\username, ClaimsCount=24 da1f909d-545f-60b2-1cdd-8923ed950a7a 07/15/2016 23:28:06.77 w3wp.exe (0x0E40) 0x2B54 SharePoint Foundation Logging Correlation Data xmnv Medium Site=/ da1f909d-545f-60b2-1cdd-8923ed950a7a 07/15/2016 23:28:06.78 w3wp.exe (0x0E40) 0x2B54 SharePoint Foundation Files ak8dj High UserAgent not available, file operations may not be optimized. at Microsoft.SharePoint.SPFileStreamManager.CreateCobaltStreamContainer(SPFileStreamStore spfs, ILockBytes ilb, Boolean copyOnFirstWrite, Boolean disposeIlb) at Microsoft.SharePoint.SPFileStreamManager.SetInputLockBytes(SPFileInfo& fileInfo, SqlSession session, PrefetchResult prefetchResult) at Microsoft.SharePoint.CoordinatedStreamBuffer.SPCoordinatedStreamBufferFactory.CreateFromDocumentRowset(Guid databaseId, SqlSession session, SPFileStreamManager spfstm, Object[] metadataRow, SPRowset contentRowset, SPDocumentBindRequest& dbreq, SPDocumentBindResults& dbres) at Microsoft.SharePoint.SPSqlClient.GetDocumentContentRow(Int32 rowOrd, Object ospFileStmMgr, SPDocumentBindRequest& dbreq, SPDocumentBindResults& dbres... da1f909d-545f-60b2-1cdd-8923ed950a7a 07/15/2016 23:28:06.78* w3wp.exe (0x0E40) 0x2B54 SharePoint Foundation Files ak8dj High ...) at Microsoft.SharePoint.Library.SPRequestInternalClass.GetFileAndMetaInfo(String bstrUrl, Byte bPageView, Byte bPageMode, Byte bGetBuildDependencySet, String bstrCurrentFolderUrl, Int32 iRequestVersion, Byte bMainFileRequest, Boolean& pbCanCustomizePages, Boolean& pbCanPersonalizeWebParts, Boolean& pbCanAddDeleteWebParts, Boolean& pbGhostedDocument, Boolean& pbDefaultToPersonal, Boolean& pbIsWebWelcomePage, String& pbstrSiteRoot, Guid& pgSiteId, UInt32& pdwVersion, String& pbstrTimeLastModified, String& pbstrContent, UInt32& pdwPartCount, Object& pvarMetaData, Object& pvarMultipleMeetingDoclibRootFolders, String& pbstrRedirectUrl, Boolean& pbObjectIsList, Guid& pgListId, UInt32& pdwItemId, Int64& pllListFlags, Boolean& pbAccessDenied, Guid& pgDocid, Byte& piLevel, UInt64& ppermMask, ... da1f909d-545f-60b2-1cdd-8923ed950a7a 07/15/2016 23:28:06.78* w3wp.exe (0x0E40) 0x2B54 SharePoint Foundation Files ak8dj High ...Object& pvarBuildDependencySet, UInt32& pdwNumBuildDependencies, Object& pvarBuildDependencies, String& pbstrFolderUrl, String& pbstrContentTypeOrder, Guid& pgDocScopeId) at Microsoft.SharePoint.Library.SPRequestInternalClass.GetFileAndMetaInfo(String bstrUrl, Byte bPageView, Byte bPageMode, Byte bGetBuildDependencySet, String bstrCurrentFolderUrl, Int32 iRequestVersion, Byte bMainFileRequest, Boolean& pbCanCustomizePages, Boolean& pbCanPersonalizeWebParts, Boolean& pbCanAddDeleteWebParts, Boolean& pbGhostedDocument, Boolean& pbDefaultToPersonal, Boolean& pbIsWebWelcomePage, String& pbstrSiteRoot, Guid& pgSiteId, UInt32& pdwVersion, String& pbstrTimeLastModified, String& pbstrContent, UInt32& pdwPartCount, Object& pvarMetaData, Object& pvarMultipleMeetingDoclibRootFolders, String& pbst... da1f909d-545f-60b2-1cdd-8923ed950a7a 07/15/2016 23:28:06.78* w3wp.exe (0x0E40) 0x2B54 SharePoint Foundation Files ak8dj High ...rRedirectUrl, Boolean& pbObjectIsList, Guid& pgListId, UInt32& pdwItemId, Int64& pllListFlags, Boolean& pbAccessDenied, Guid& pgDocid, Byte& piLevel, UInt64& ppermMask, Object& pvarBuildDependencySet, UInt32& pdwNumBuildDependencies, Object& pvarBuildDependencies, String& pbstrFolderUrl, String& pbstrContentTypeOrder, Guid& pgDocScopeId) at Microsoft.SharePoint.Library.SPRequest.GetFileAndMetaInfo(String bstrUrl, Byte bPageView, Byte bPageMode, Byte bGetBuildDependencySet, String bstrCurrentFolderUrl, Int32 iRequestVersion, Byte bMainFileRequest, Boolean& pbCanCustomizePages, Boolean& pbCanPersonalizeWebParts, Boolean& pbCanAddDeleteWebParts, Boolean& pbGhostedDocument, Boolean& pbDefaultToPersonal, Boolean& pbIsWebWelcomePage, String& pbstrSiteRoot, Guid& pgSiteId, UInt32& pdwVersion,... da1f909d-545f-60b2-1cdd-8923ed950a7a 07/15/2016 23:28:06.78* w3wp.exe (0x0E40) 0x2B54 SharePoint Foundation Files ak8dj High ... String& pbstrTimeLastModified, String& pbstrContent, UInt32& pdwPartCount, Object& pvarMetaData, Object& pvarMultipleMeetingDoclibRootFolders, String& pbstrRedirectUrl, Boolean& pbObjectIsList, Guid& pgListId, UInt32& pdwItemId, Int64& pllListFlags, Boolean& pbAccessDenied, Guid& pgDocid, Byte& piLevel, UInt64& ppermMask, Object& pvarBuildDependencySet, UInt32& pdwNumBuildDependencies, Object& pvarBuildDependencies, String& pbstrFolderUrl, String& pbstrContentTypeOrder, Guid& pgDocScopeId) at Microsoft.SharePoint.SPWeb.GetWebPartPageContent(Uri pageUrl, Int32 pageVersion, PageView requestedView, HttpContext context, Boolean forRender, Boolean includeHidden, Boolean mainFileRequest, Boolean fetchDependencyInformation, Boolean& ghostedPage, String& siteRoot, Guid& siteId, Int64& bytes, ... da1f909d-545f-60b2-1cdd-8923ed950a7a 07/15/2016 23:28:06.78* w3wp.exe (0x0E40) 0x2B54 SharePoint Foundation Files ak8dj High ...Guid& docId, UInt32& docVersion, String& timeLastModified, Byte& level, Object& buildDependencySetData, UInt32& dependencyCount, Object& buildDependencies, SPWebPartCollectionInitialState& initialState, Object& oMultipleMeetingDoclibRootFolders, String& redirectUrl, Boolean& ObjectIsList, Guid& listId) at Microsoft.SharePoint.ApplicationRuntime.SPRequestModuleData.FetchWebPartPageInformationForInit(HttpContext context, SPWeb spweb, Boolean mainFileRequest, String path, Boolean impersonate, Boolean& isAppWeb, Boolean& fGhostedPage, Guid& docId, UInt32& docVersion, String& timeLastModified, SPFileLevel& spLevel, String& masterPageUrl, String& customMasterPageUrl, String& webUrl, String& siteUrl, Guid& siteId, Object& buildDependencySetData, SPWebPartCollectionInitialState& initialState, ... da1f909d-545f-60b2-1cdd-8923ed950a7a 07/15/2016 23:28:06.78* w3wp.exe (0x0E40) 0x2B54 SharePoint Foundation Files ak8dj High ...String& siteRoot, String& redirectUrl, Object& oMultipleMeetingDoclibRootFolders, Boolean& objectIsList, Guid& listId, Int64& bytes) at Microsoft.SharePoint.ApplicationRuntime.SPRequestModuleData.GetWebPartPageData(HttpContext context, String path, Boolean throwIfFileNotFound) at Microsoft.SharePoint.ApplicationRuntime.SPVirtualPathProvider.GetCacheKey(String virtualPath) at System.Web.Compilation.BuildManager.GetVPathBuildResultFromCacheInternal(VirtualPath virtualPath, Boolean ensureIsUpToDate) at System.Web.Compilation.BuildManager.GetVPathBuildResultInternal(VirtualPath virtualPath, Boolean noBuild, Boolean allowCrossApp, Boolean allowBuildInPrecompile, Boolean throwIfNotFound, Boolean ensureIsUpToDate) at System.Web.Compilation.BuildManager.GetVPathBuildResultWithN... da1f909d-545f-60b2-1cdd-8923ed950a7a 07/15/2016 23:28:06.78* w3wp.exe (0x0E40) 0x2B54 SharePoint Foundation Files ak8dj High ...oAssert(HttpContext context, VirtualPath virtualPath, Boolean noBuild, Boolean allowCrossApp, Boolean allowBuildInPrecompile, Boolean throwIfNotFound, Boolean ensureIsUpToDate) at System.Web.Compilation.BuildManager.GetVPathBuildResult(HttpContext context, VirtualPath virtualPath, Boolean noBuild, Boolean allowCrossApp, Boolean allowBuildInPrecompile, Boolean ensureIsUpToDate) at System.Web.UI.MasterPage.CreateMaster(TemplateControl owner, HttpContext context, VirtualPath masterPageFile, IDictionary contentTemplateCollection) at System.Web.UI.Page.ApplyMasterPage() at System.Web.UI.Page.PerformPreInit() at System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) at System.Web.UI.Page.ProcessRequest(Boolean in... da1f909d-545f-60b2-1cdd-8923ed950a7a 07/15/2016 23:28:06.78* w3wp.exe (0x0E40) 0x2B54 SharePoint Foundation Files ak8dj High ...cludeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) at System.Web.UI.Page.ProcessRequest() at System.Web.UI.Page.ProcessRequest(HttpContext context) at System.Web.HttpApplication.CallHandlerExecutionStep.System.Web.HttpApplication.IExecutionStep.Execute() at System.Web.HttpApplication.ExecuteStep(IExecutionStep step, Boolean& completedSynchronously) at System.Web.HttpApplication.PipelineStepManager.ResumeSteps(Exception error) at System.Web.HttpApplication.BeginProcessRequestNotification(HttpContext context, AsyncCallback cb) at System.Web.HttpRuntime.ProcessRequestNotificationPrivate(IIS7WorkerRequest wr, HttpContext context) at System.Web.Hosting.PipelineRuntime.ProcessRequestNotificationHelper(IntPtr rootedObjectsPointer, IntPtr nativeReque... da1f909d-545f-60b2-1cdd-8923ed950a7a 07/15/2016 23:28:06.78* w3wp.exe (0x0E40) 0x2B54 SharePoint Foundation Files ak8dj High ...stContext, IntPtr moduleData, Int32 flags) at System.Web.Hosting.PipelineRuntime.ProcessRequestNotification(IntPtr rootedObjectsPointer, IntPtr nativeRequestContext, IntPtr moduleData, Int32 flags) at System.Web.Hosting.UnsafeIISMethods.MgdIndicateCompletion(IntPtr pHandler, RequestNotificationStatus& notificationStatus) at System.Web.Hosting.UnsafeIISMethods.MgdIndicateCompletion(IntPtr pHandler, RequestNotificationStatus& notificationStatus) at System.Web.Hosting.PipelineRuntime.ProcessRequestNotificationHelper(IntPtr rootedObjectsPointer, IntPtr nativeRequestContext, IntPtr moduleData, Int32 flags) at System.Web.Hosting.PipelineRuntime.ProcessRequestNotification(IntPtr rootedObjectsPointer, IntPtr nativeRequestContext, IntPtr moduleData, Int32 flags) da1f909d-545f-60b2-1cdd-8923ed950a7a 07/15/2016 23:28:06.78 w3wp.exe (0x0E40) 0x2B54 SharePoint Foundation Files aiv4w Medium Spent 0 ms to bind 29798 byte file stream da1f909d-545f-60b2-1cdd-8923ed950a7a 07/15/2016 23:28:06.80 w3wp.exe (0x0E40) 0x2B54 Web Content Management Publishing 7fz3 Medium Setting [Display] as the FormContext.FormMode for the current page da1f909d-545f-60b2-1cdd-8923ed950a7a 07/15/2016 23:28:06.83 w3wp.exe (0x0E40) 0x2B54 SharePoint Foundation General 8nca Medium Application error when access /_layouts/15/Workflow.aspx, Error=Could not load file or assembly 'Microsoft.Workflow.Client, Version=1.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35' or one of its dependencies. The system cannot find the file specified. at Microsoft.SharePoint.WorkflowServices.FabricWorkflowInstanceProvider.EnumerateByMonitoringParameter(Guid monitoringParameter, Int32 offset, Int32 count, Boolean checkPermissions, Nullable`1 secondaryMonitoringParameter) at Microsoft.SharePoint.WorkflowServices.FabricWorkflowInstanceProvider.EnumerateInstancesForListItem(Guid listId, Int32 itemId, Int32 offset) at Microsoft.SharePoint.WorkflowServices.FabricWorkflowInstanceProvider.EnumerateInstancesForListItem(Guid listId, Int32 itemId) at Microsoft.SharePoint.Workf... da1f909d-545f-60b2-1cdd-8923ed950a7a 07/15/2016 23:28:06.83* w3wp.exe (0x0E40) 0x2B54 SharePoint Foundation General 8nca Medium ...lowServices.ApplicationPages.WorkflowPageBase.ConstructStatusArraysWF4(ArrayList running, ArrayList completed, Boolean onlyMyWorkflows) at Microsoft.SharePoint.WorkflowServices.ApplicationPages.WorkflowPage.ConstructStatusArrays() at Microsoft.SharePoint.WorkflowServices.ApplicationPages.WorkflowPage.OnLoad(EventArgs e) at System.Web.UI.Control.LoadRecursive() at System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) da1f909d-545f-60b2-1cdd-8923ed950a7a 07/15/2016 23:28:06.83 w3wp.exe (0x0E40) 0x2B54 SharePoint Foundation Runtime tkau Unexpected System.IO.FileNotFoundException: Could not load file or assembly 'Microsoft.Workflow.Client, Version=1.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35' or one of its dependencies. The system cannot find the file specified. at Microsoft.SharePoint.WorkflowServices.FabricWorkflowInstanceProvider.EnumerateByMonitoringParameter(Guid monitoringParameter, Int32 offset, Int32 count, Boolean checkPermissions, Nullable`1 secondaryMonitoringParameter) at Microsoft.SharePoint.WorkflowServices.FabricWorkflowInstanceProvider.EnumerateInstancesForListItem(Guid listId, Int32 itemId, Int32 offset) at Microsoft.SharePoint.WorkflowServices.FabricWorkflowInstanceProvider.EnumerateInstancesForListItem(Guid listId, Int32 itemId) at Microsoft.SharePoint.WorkflowServices.ApplicationPages.W... da1f909d-545f-60b2-1cdd-8923ed950a7a 07/15/2016 23:28:06.83* w3wp.exe (0x0E40) 0x2B54 SharePoint Foundation Runtime tkau Unexpected ...orkflowPageBase.ConstructStatusArraysWF4(ArrayList running, ArrayList completed, Boolean onlyMyWorkflows) at Microsoft.SharePoint.WorkflowServices.ApplicationPages.WorkflowPage.ConstructStatusArrays() at Microsoft.SharePoint.WorkflowServices.ApplicationPages.WorkflowPage.OnLoad(EventArgs e) at System.Web.UI.Control.LoadRecursive() at System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) da1f909d-545f-60b2-1cdd-8923ed950a7a 07/15/2016 23:28:06.83 w3wp.exe (0x0E40) 0x2B54 SharePoint Foundation General ajlz0 High Getting Error Message for Exception System.Web.HttpUnhandledException (0x80004005): Exception of type 'System.Web.HttpUnhandledException' was thrown. ---> System.IO.FileNotFoundException: Could not load file or assembly 'Microsoft.Workflow.Client, Version=1.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35' or one of its dependencies. The system cannot find the file specified. File name: 'Microsoft.Workflow.Client, Version=1.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35' at Microsoft.SharePoint.WorkflowServices.FabricWorkflowInstanceProvider.EnumerateByMonitoringParameter(Guid monitoringParameter, Int32 offset, Int32 count, Boolean checkPermissions, Nullable`1 secondaryMonitoringParameter) at Microsoft.SharePoint.WorkflowServices.FabricWorkflowInstanceProvider.Enum... da1f909d-545f-60b2-1cdd-8923ed950a7a 07/15/2016 23:28:06.83* w3wp.exe (0x0E40) 0x2B54 SharePoint Foundation General ajlz0 High ...erateInstancesForListItem(Guid listId, Int32 itemId, Int32 offset) at Microsoft.SharePoint.WorkflowServices.FabricWorkflowInstanceProvider.EnumerateInstancesForListItem(Guid listId, Int32 itemId) at Microsoft.SharePoint.WorkflowServices.ApplicationPages.WorkflowPageBase.ConstructStatusArraysWF4(ArrayList running, ArrayList completed, Boolean onlyMyWorkflows) at Microsoft.SharePoint.WorkflowServices.ApplicationPages.WorkflowPage.ConstructStatusArrays() at Microsoft.SharePoint.WorkflowServices.ApplicationPages.WorkflowPage.OnLoad(EventArgs e) at System.Web.UI.Control.LoadRecursive() at System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) at System.Web.UI.Page.HandleError(Exception e) at System.W... da1f909d-545f-60b2-1cdd-8923ed950a7a 07/15/2016 23:28:06.83* w3wp.exe (0x0E40) 0x2B54 SharePoint Foundation General ajlz0 High ...eb.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) at System.Web.UI.Page.ProcessRequest(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) at System.Web.UI.Page.ProcessRequest() at System.Web.UI.Page.ProcessRequest(HttpContext context) at System.Web.HttpApplication.CallHandlerExecutionStep.System.Web.HttpApplication.IExecutionStep.Execute() at System.Web.HttpApplication.ExecuteStep(IExecutionStep step, Boolean& completedSynchronously) da1f909d-545f-60b2-1cdd-8923ed950a7a 07/15/2016 23:28:06.83 w3wp.exe (0x0E40) 0x2B54 SharePoint Foundation General aat87 Monitorable da1f909d-545f-60b2-1cdd-8923ed950a7a 07/15/2016 23:28:06.83 w3wp.exe (0x0E40) 0x2B54 SharePoint Foundation Micro Trace uls4 Medium Micro Trace Tags: 0 nasq,2 agb9s,20 ak8dj,12 7fz3,29 8nca,0 tkau,0 ajlz0,0 aat87 da1f909d-545f-60b2-1cdd-8923ed950a7a 07/15/2016 23:28:06.83 w3wp.exe (0x0E40) 0x2B54 SharePoint Foundation Monitoring b4ly Medium Leaving Monitored Scope (Request (GET:http://mysharepointapplication:80/newsite/test/_layouts/15/Workflow.aspx?ID=20&List=%7B18957A04-11A4-4016-9404-B1D3897619EF%7D&Source=http%3A%2F%2Fmysharepointapplication%2Fit%2Fsystems%2Fsystems%2Ftest%2FLists%2FCustom%2520List%2FAllItems%2Easpx%3FInitialTabId%3DRibbon%252ERead%26VisibilityContext%3DWSSTabPersistence)). Execution Time=69.4163 da1f909d-545f-60b2-1cdd-8923ed950a7a [/code]


I would really like to thank Stephan Bren for answering here and it worked for me perfectly fine. Below are the steps i followed and it worked. You may need to do further steps in case the issue do not fix.

  1. Install hotfix KB2880963.
  2. On the application server hosting Workflow Manager 2013, stop and restart these services:
    • Service Bus GatewayService
    • Bus Message Broker
    • Workflow Manager Backend
  3. Lastly, restart IIS on the WFEs.
References
Notes
  • After installing this hotfix on all of the SharePoint 2013 servers, you may find that running the SharePoint Products Configuration Wizard returns an error:
    Error: Some farm products and patches were not detected on this or other servers. If products or patches are missing locally...
    If this occurs, execute Get-SPProduct -Local on each of the machines identified in the error message.  It may take several minutes for this command to finish.
  • In Solution Step 2), above, I mention restarting workflow services.  It's not clear to me whether all of them need to be restarted, one or more of them, or maybe just restarting IIS, or some other combination of these.  Whichever the case may be, this is the combination I did to recover from experiencing an error clicking on Workflows for a list item, after installing the hotfix.  This approach worked for resolving this problem on both my development and production farms.

How to get custom user profile property from SharePoint User Profile Service using JavaScript AJAX client side script

Hi There,

SharePoint provides a wonderful facility of client side scripts to get data from SharePoint objects. You can get custom user profile property from SharePoint User Profile Service using JavaScript AJAX calls. Below is an example.

I have an AD property with name "Initials" that do not comes in SharePoint OOTB  User Profile Service and you have to bind it manually.

I have set its internal name also "Initials" in my User Profile Service while binding it. We'll call this property using the same name. Remember that, you can only call a User Profile Property from its internal name.


I have bonded it with "Initials" attribute of AD and set the Direction to Import. Click Add.



Now the custom property is appearing when i edit any user profile.


Below is my JavaScript code.

[code]//Display User profile properties function getMyUserProfile(success, error) { var siteUrl = _spPageContextInfo.siteAbsoluteUrl; //You can replace this with your site URL too. i.e http://anysite.com $.ajax({ url: siteUrl + "/_api/SP.UserProfiles.PeopleManager/GetMyProperties", method: "GET", headers: { "Accept": "application/json; odata=verbose" }, success: function (data) { var json = $.parseJSON(JSON.stringify(data.d)); alert("Hello " + json.DisplayName + " Your Job Title Is : " + json.Title + " Profile Picture URL is :"+ json.PictureUrl + " MySite URL is :"+ json.PersonalUrl); for (var i = 0; i < data.d.UserProfileProperties.results.length; i++) { if (data.d.UserProfileProperties.results[i].Key == "Initials") { alert("Your Custom Property Initials is : " + data.d.UserProfileProperties.results[i].Value); } } }, error: error }); } // Usage getMyUserProfile(function (properties) {}, function (data) { console.log(JSON.stringify(data)); }); [/code]
Boom...! It worked for me.

You can check some suggested codes here too which worked fine and provide another way to use the same code. I am also posting that samples below.

Sample 1:

[code]SP.SOD.executeOrDelayUntilScriptLoaded(getUserProperties, 'SP.UserProfiles.js');

    var userProfileProperties;

    function getUserProperties() {
    var clientContext = new SP.ClientContext.get_current();
    var peopleManager = new SP.UserProfiles.PeopleManager(clientContext);
    userProfileProperties = peopleManager.getMyProperties();
    clientContext.load(userProfileProperties);
    clientContext.executeQueryAsync(onRequestSuccess, onRequestFail);
    }
    function onRequestSuccess() {
    var Bild = userProfileProperties.get_userProfileProperties()['PictureURL']
    document.getElementById("div").innerHTML = userProfileProperties.get_userProfileProperties()['WorkEmail'];
    document.getElementById("div1").innerHTML = userProfileProperties.get_userProfileProperties()['PreferredName'];
    document.getElementById("div2").innerHTML = userProfileProperties.get_userProfileProperties()['WorkPhone'];
    $("#bild").attr('src', Bild);
    }

    function onRequestFail(sender, args) { alert( args.get_message());}[/code]

Sample 2:

[code]<script type="text/javascript">


    var workEmail = "";
    var EmployeeID = "";
    var Division = "";
    var userDisplayName = "";
    var AccountName = "";

    $.ajax({

        url: _spPageContextInfo.webAbsoluteUrl + "/_api/SP.UserProfiles.PeopleManager/GetMyProperties",
        headers: { Accept: "application/json;odata=verbose" },
        success: function (data) {
            try {
                //Get properties from user profile Json response
                userDisplayName = data.d.DisplayName;
                AccountName = data.d.AccountName;
                var properties = data.d.UserProfileProperties.results;
                for (var i = 0; i < properties.length; i++) {

                    if (property.Key == "WorkEmail") {
                        workEmail = property.Value;
                    }

                    if (property.Key == "EmployeeID") {
                        EmployeeID = property.Value;
                    }
                    if (property.Key == "Division") {
                        Division = property.Value;
                    }

                }
                $('#AccountName').text(AccountName);
                $('#userDisplayName').text(userDisplayName);
                $('#EmployeeID').text(EmployeeID);
                $('#workEmail').text(workEmail);
                $('#Division').text(Division);


            } catch (err2) {
                //alert(JSON.stringify(err2));
            }
        },
        error: function (jQxhr, errorCode, errorThrown) {
            alert(errorThrown);
        }
    });

</script>

<br />
<h2>
<strong>Employee Details</strong></h2>
<br />
AccountName   <span id="AccountName"></span>
DisplayName   <span id="userDisplayName"></span>
EmployeeID    <span id="EmployeeID"></span>
Email Address <span id="workEmail"></span>
Division      <span id="Division"></span></div>[/code]

SharePoint Client Side REST API 500 Internal Server Error

Hi There,

I have been now in code again since last two months and facing the developer life challenges :P .

I am calling the GetMyProperties from client side REST API method "/_api/SP.UserProfiles.PeopleManager/GetMyProperties" but my site is throwing 500 internal server error or 400 bad request. Life time annoying errors :-/ . My code was working fine on my dev machine but not on client's server, so apparently its a server configuration issue.

Things to check when you get 500 Internal Server Error or similar IIS erros on "/_api/XXXXXXXXXXXXXXXX" or same kind of issues is, 

1. Check your User Profile Service is running properly
2. Check your my site is configured properly
3. Check your my site is configured in my site host application in User Profile Service

In my case, the issue was, my MySite was not configured in User Profile Service and when i open MySite it throws error and a correlation ID. So i added my MySite in User Profile Service and also enabled Self-Service Site Creation on my MySite. After that my MySite appeared fine and so my code also worked fine and returned me the required data.


[code] //Display User profile properties on top header function getMyUserProfile(success, error) { var siteUrl = _spPageContextInfo.siteAbsoluteUrl; $.ajax({ url: siteUrl + "/_api/SP.UserProfiles.PeopleManager/GetMyProperties", method: "GET", headers: { "Accept": "application/json; odata=verbose" }, success: function (data) { var json = $.parseJSON(JSON.stringify(data.d)); alert(json.DisplayName); }, error: error }); } [/code]


    

Traverse all users permissions on SharePoint 2010,2013 Site Collection PowerShell

Hi There,

I have found a very useful PowerShell script to traverse all users permissions on SharePoint 2010,2013 Site Collection using PowerShell. Thanks to Johan Mayer for updating the PowerShell code and making it more useful.

This PowerShell code will traverse or extract all users having permissions through any of SharePoint group and any level of permission. For example, if a User has permissions using three groups Readers, Contributors and Owners, it will show all groups one by one and describe the user permissions level in each group. Sample screenshot below.



PowerShell Script:

You can copy and paste this PowerShell script in a simple notepad file and save as .ps1 file. Now run SharePoint Management Shell and point to the file where you have just saved.

This script will traverse users permissions inside the lists/libraries too. You can filter the data once exported in CSV.

[code]function Get-SPUserEffectivePermissions( [object[]]$users, [Microsoft.SharePoint.SPSecurableObject]$InputObject) { begin { } process { $so = $InputObject if ($so -eq $null) { $so = $_ } if ($so -isnot [Microsoft.SharePoint.SPSecurableObject]) { throw "A valid SPWeb, SPList, or SPListItem must be provided." } foreach ($user in $users) { # Set the users login name $loginName = $user if ($user -is [Microsoft.SharePoint.SPUser] -or $user -is [PSCustomObject]) { $loginName = $user.LoginName } if ($loginName -eq $null) { throw "The provided user is null or empty. Specify a valid SPUser object or login name." } # Get the users permission details. $permInfo = $so.GetUserEffectivePermissionInfo($loginName) # Determine the URL to the securable object being evaluated $resource = $null if ($so -is [Microsoft.SharePoint.SPWeb]) { $resource = $so.Url } elseif ($so -is [Microsoft.SharePoint.SPList]) { $resource = $so.ParentWeb.Site.MakeFullUrl($so.RootFolder.ServerRelativeUrl) } elseif ($so -is [Microsoft.SharePoint.SPListItem]) { $resource = $so.ParentList.ParentWeb.Site.MakeFullUrl($so.Url) } # Get the role assignments and iterate through them $roleAssignments = $permInfo.RoleAssignments if ($roleAssignments.Count -gt 0) { foreach ($roleAssignment in $roleAssignments) { $member = $roleAssignment.Member # Build a string array of all the permission level names $permName = @() foreach ($definition in $roleAssignment.RoleDefinitionBindings) { $permName += $definition.Name } # Determine how the users permissions were assigned $assignment = "Direct Assignment" if ($member -is [Microsoft.SharePoint.SPGroup]) { $assignment = $member.Name } else { if ($member.IsDomainGroup -and ($member.LoginName -ne $loginName)) { $assignment = $member.LoginName } } # Create a hash table with all the data $hash = @{ Resource = $resource "Resource Type" = $so.GetType().Name User = $loginName Permission = $permName -join ", " "Granted By" = $assignment } # Convert the hash to an object and output to the pipeline New-Object PSObject -Property $hash } } } } end {} } $site = $gc | Get-SPSite http://localhost:2020 $groups = $site.RootWeb.sitegroups foreach ($grp in $groups) { foreach ($user in $grp.users) { $user = $user.LoginName $webPermissions = $site | Get-SPWeb –Limit All | Get-SPUserEffectivePermissions $user $listPermissions = $site | Get-SPWeb –Limit All | %{$_.Lists | Get-SPUserEffectivePermissions $user} ($webPermissions + $listPermissions) | ConvertTo-Csv -NoTypeInformation | Add-Content -Path c:\perms.csv } Add-Content -Path c:\perms.csv -Value $justData -Encoding UTF8 } $site.Dispose() $gc | Stop-SPAssignment[/code]

You can also download the script from here.

Enjoy...!

SharePoint 2013 Blog Post Error : TypeError: Unable to get property 'id' of undefined or null reference

Hi There,

Its a brand new installation with no customization on SharePoint site. I created a blog type subsite called "News" in SharePoint and faced the below error. This error comes up when i created a blog post in SharePoint from User1 account and then open the same post with User2 account which had read only permissions on the site. 



TypeError: Unable to get property 'id' of undefined or null reference
OR
TypeError: Unable to get property 'trim' of undefined or null reference

My current version of SharePoint was RTM 15.0.4420.1017. I installed the SharePoint Server SP1 (15.0.4569.1000) and the error "TypeError: Unable to get property 'id' of undefined or null reference" went away. Mean while i tested the same thing on another RTM version of SharePoint where it worked fine without any issue and installation of SP1. Hope it will help someone...!

Happy SharePointing...!

How to use CAML query with SharePoint 2013 List

Hi There,

So its a very basic question that how would you use a CAML query to fetch items from a SharePoint list? Its very simple to use and very fast as compared to other list query options. Below is the stuff to understand.

I have a list that have Posts of my blog as its a blog site. I have to query below few columns using their internal names. 


To find internal name of the columns, you can use a tool "SP CAML Query Helper Online"  or try with any other method. This tool is very helpful in building CAML query. In below screenshot i am using internal name of "# Comments" which is  "NumComments".


The Code:
                  I am getting most recent three items from the list based on the created date and order by Created date descending. 

The columns you wan to select from the list should be in ViewFields.


private SPListItemCollection GetListItems(SPList oList)
{
string sQuery = @"<OrderBy><FieldRef Name='Created' Ascending='False' /></OrderBy>";
string sViewFields = @"<FieldRef Name=""ID"" /><FieldRef Name=""LinkTitleNoMenu"" /><FieldRef Name=""Author"" /><FieldRef Name=""LikesCount"" /><FieldRef Name=""NumComments"" />";
string sViewAttrs = @"Scope=""Recursive""";
uint iRowLimit = 3;

var oQuery = new SPQuery();
oQuery.Query = sQuery;
oQuery.ViewFields = sViewFields;
oQuery.ViewAttributes = sViewAttrs;
oQuery.RowLimit = iRowLimit;
oQuery.ViewFieldsOnly = true;

SPListItemCollection collListItems = oList.GetItems(oQuery);

return collListItems;

}


This pass this method your list object and it will return the desired data.

Hope this will help someone to get idea.

Happy SharePointing...!

The partial project item type does not have a value for this property. Visual Studio 2012 & SharePoint

Hi There,

I am building a custom master page for SharePoint branding and noticed that my Visual Studio 2012 shows a red cross sign on the master page module. As soon as deploy the solution, it throws the error below.

Error: The partial project item type does not have a value for this property.


Thanks to Muhammad Tayyab Khan for writing this post. It solved my problem.

Solution was very simple.


Modified the "SharePointProjectItem.spdata" on which module its showing red cross sign to  added the value SupportedTrustLevels="All"  SupportedDeploymentScopes="Web, Site"   in the <ProjectItem>.

It will look like below.


Redeploy the solution. It worked for me and no more error.

Update (02/29/2016):
Although it fixed my error but the Red Cross icon was still showing on adding SharePoint item in the solution. I installed Visual Studio update 3 and it fixed my problem.

https://social.msdn.microsoft.com/Forums/office/en-US/dd7f20ad-2f27-48dc-93d2-fc715689c4dd/visual-studio-2012-sharepoint-project-error-the-partial-project-item-type-does-not-have-a-value?forum=sharepointdevelopment

Download: Visual Studio 2012 Update 3 

SharePoint 2013 Workflow Manager supports only odd (1 & 3) servers in Workflow Manager Farm

SharePoint 2013 Workflow Manager supports only odd (1 & 3) servers in Workflow Manager Farm

Hi There,

Yes that is true...!

Probably i am the only one who is late to know this but just want to share it if someone else missed it too.

I have recently configured a SharePoint 2013 farm with 2 WFEs, 2 APPs and 2 DB servers (in Active-Passive mode with failover setup). I have configured SharePoint Workflow Manager on all of the WFE and APP servers to build WFM farm. Everything worked fine until we faced an issue that republishing the SharePoint Workflows are not working and causing workflow crash. We opened a ticket with Microsoft and they told that Workflow Manager do not support even number of servers (4 in our case). Workflow manager supports only odd (1 or 3) servers in a Workflow Manager farm. Strange but true. I believe it could be due to the limitations of Service Bus as Workflow Manager depends on it. Service bus supports only odd servers 1,3 and somewhere i have read that now it can support 5 servers.

Conclusion: While configuring your Workflow Manager farm, always stick with 1 or 3 servers. You can install WFM client on other servers like WFEs. Preferably install WFM on a separate server.

Reference:

Workflow Manager Supports Odd Servers Farm SharePoint 2013

Workflow Manager Supports Odd Servers Farm SharePoint 2013

Hi There,

I didn't know this before about Workflow Manager (although had this idea about Service Bus) that Workflow Manager do not support  the Workflow Manager farm in even numbers. You can have 1 or 3 Workflow Manager servers not 2 or 4. Workflow Manager farm only works with odd number of servers in the farm. I believe this is due to Service Bus limitations. See references for more.




User Profile Service Connection Disabled After Creating

Hi There,

This is SharePoint world and we see multiple strange behaviors of SharePoint sometimes. Today i have creating a new User Profile Service and created a User Profile Service AD Synchronization Connection. However, after populating the containers and creating a connection successfully i tried to add a filter in the connection but noticed that my connection is not editable. Whatttt???? Yeah... User Profile Service AD Synchronization Connection seems disabled and not showing the dropdown for edit. Here is how it looked to me.





I googled around but found no clue. However, a point suddenly hit my mind and i changed the Zone of my CA url from Trusted Zone to Intranet Zone in my IE settings.


Refreshed the page and Boooommmm.....! It worked.


Happy SharePointing...!

Workflow Manager Architecture SharePoint 2013

Hi There,


There are a lot of material to guide you how to install Workflow Manager with SharePoint 2013. I'll try to cover the points mentioned below in few words only,

1. Where to install Workflow Manager in SharePoint 2013 farm?
2. Do i need to install Workflow Manager on all SharePoint servers in the farm?
3. Do i need to install Workflow Manager on WFE's too in my farm?
4. Minimum which version of Workflow Manager is stable till today? (24-Jan-2016)
5. What is the sequence of installing Workflow Manager in SharePoint farm?

My SharePoint architecture is like below.

2 WFE, 2 APP and 2 DB servers with failover.



1. Where to install Workflow Manager in SharePoint 2013 farm?

Well its totally vary according to your architecture and need. In my case first of all i installed it on my APP1 server and tested the workflows which went fine. However when i tested the same from WFE's it threw me error of file not found. Simply it was pointing to Workflow Manager DLLs which were not present on my WFE's. I copied manually from GAC (the wrong approach) which didn't work. So i had to install Workflow Manager on WFE's as well.

Download the WebPlatformInstaller and select only "Workflow Manager" to install. It will automatically install its prerequisites like Windows Fabric, Service Bus etc.

2. Do i need to install Workflow Manager on all SharePoint servers in the farm?

NO, you don't need to install it on all servers in the farm. Just install it on one or more servers which will host the Workflow Manager and the servers which will serve the user requests i.e WFE's. No need to install if you have dedicated servers for Search crawl, UPS or any other. If you can have a dedicated server for Workflow Manager only, that would be more efficient. But you have to install it on WFE's otherwise it will not work.

3. Do i need to install Workflow Manager on WFE's too in my farm?

As described above, you don't need to install on all servers BUT, you must install it on WFE's. Installing only the Workflow Manager client would be fine but that do not comes solely. Using WebPlatformInstaller you get only the option to install Workflow Manager and it will install the client itself.

4. Minimum which version of Workflow Manager is stable till today? (24-Jan-2016)

I have installed Workflow Manager > CU1 > CU2 and it worked fine. However recently Microsoft released the CU3 (on 3-12-2015) of Workflow Manger which i have installed. After installing i noticed that my Workflow Manager Backend service is not running anymore. I tried to fix but no gain. So i would say till today the CU2 is the more stable release. 

Workflow Manager without CU2 is not a stable release. When you'll be registering your web application against a scope, it will give you a File Not Found Error. So, better to install the CU2 refresh. CU2 refresh is dependent on Service Bus CU1, so first install Service Bus CU1 and then CU2 refresh. All these can be installed from Web Platform Installer.

5. What is the sequence of installing Workflow Manager in SharePoint farm?

The sequence is pretty simple but for a new SharePointer it could be difficult.

a. On the server you want to host the workflows (mostly APP servers) install in following sequence
    1. First install Workflow Manager (It will install Service Bus and Windows Fabric too)
    2. Now install Service Bus CU1
    3. Then install Workflow Manager CU2
    4. Create a Workflow Manager farm

b. On the WFE's install in following sequence
    1. Install the Workflow Manager 1.0
    2. Join to the Workflow Manager farm




Workflow Manager Architecture SharePoint 2013
(In my case this worked fine)



See the below article for installing Workflow Manager Step by Step with SharePoint 2013 on multiserver SharePoint farm.



Happy SharePointing :)


SharePoint: The EXECUTE permission was denied on the object 'xp_sqlagent_notify

Hi There,

I was working with SharePoint SSRS and the reports were working fine. However when i click "View Report History" it gave me the below error.


Microsoft.ReportingServices.Diagnostics.Utilities.ReportServerStorageException: An error occurred within the report server database.  This may be due to a connection failure, timeout or low disk condition within the database. ---> System.Data.SqlClient.SqlException: The EXECUTE permission was denied on the object 'xp_sqlagent_notify', database 'mssqlsystemresource', schema 'sys'. 

  

I found an answer here but i was looking for some systematic way than running SQL Server queries. So i found a solution here which worked for me.

So the solution is:

1. Open SharePoint Central Administration > Application Management > Manage Service Applications
2. Click on your SQL Server Reporting Services Service Application
3. Click on “Provision Subscriptions and Alerts” link
4. Type a username and password for SQL Server which grants privilege to your SSRS service application pool. 
5. Save and try again

Boom....! It worked.

Happy SharePointing :)