2018-10-24

Getting Rid of http://server/Analytics_{GUID}/ Requests

When I'm developing software I often have Fiddler turned on to capture client HTTP traffic. I've noticed weird http://server/Analytics_{GUID}/ Requests appearing in a batch of 4 requests every minute:

Investigation led me to Application Server Administration Service Timer Job which in turn called Search Service Instance's Synchronize method. This method calls code which uses rather odd way of determining whether file share exists:
    private static bool ShareExists(string path)
    {
      try
      {
        Directory.GetDirectories(path);
        return true;
      }
      catch (UnauthorizedAccessException ex)
      {
        return true;
      }
      catch (Exception ex)
      {
        return false;
      }
    }

Line Directory.GetDirectories(path); causes those 4 requests. This execution path happens when you don't have Search Service Application provisioned but you do have SharePoint Server Search service started.

Anyway, I stopped the service using cmdlet:
Get-SPEnterpriseSearchServiceInstance -Local | Stop-SPEnterpriseSearchServiceInstance

And the problem was solved, no more pesky Analytics requests.

2016-12-14

Setting Related Item on a SharePoint 2013 Worfklow's SingleTask

Sometimes when we design workflows it is necessary to set related item in SingleTask to something different than the default listitem. Default list item is the item on which workflow was started. So, lets say we start workflow on doc1.docx. Inside the workflow we define SingleTask. This SingleTask, when opened in SharePoint UI, will have, by default, a link to doc1.docx. Sometimes we would like this SingleTask to have related item which is different than that particular doc1.docx.

Microsoft has intended for this purpose SingleTask argument named RelatedContentLinkListItemIntegerId. Great, you just set the list ID and item ID and you have your problem solved. Wrong!! Setting this property will have no impact on related item. At least, not if you use default generated SingleTask activity.

The solution:
Setting RelatedContentLinkListItemIntegerId will only work if you delete a particular child element in workflow markup (XAML). So, first open your workflow in Code mode (Visual Studio View Code - F7). Then locate the SingleTask activity which you would like to configure. This should be p:SingleTask XML element. Delete p:SingleTask.RelatedContentLinkListItemId child elemet. Save your workflow and voila, it will change related item to whatever value you set it.

2016-10-07

SharePoint 2016 Application Pools and Other Processes Stop Immediately After Starting

At one point of developing SharePoint 2016 Farm solution on my dev machine SharePoint application pools, namely web application pool and CA application pool, started to crash on start. I restarted the server and then all of a sudden no SharePoint services (SharePoint Timer Service, SharePoint Tracing Service) could be started.

All google results pointed to faulty application pool account. I double checked that account was not locked and had appropriate perms. No luck there.

System Event log was full of events 5002, 5009 and 5011.

After inspecting a situation with Process Monitor we pin pointed an error to missing HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Shared Tools\Web Server Extensions\16.0\Location value in the registry. After adding C:\Program Files\Common Files\Microsoft Shared\Web Server Extensions\16\ data to Location value all services went back online after server restart.

Only change in server configuration that day was installment of Microsoft Office Professional Plus 2016. I don't have time to investigate what caused deletion of aforementioned value in registry but I am eager to find out.

Hopefully, I will edit this post if I find out more details.

2016-05-02

OpenQuery Failed with status ID: 0x800007d0

ULS on my clients' farm was polluted by messages "OpenQuery Failed with status ID: 0x800007d0" every few seconds.

Turns out I had to add user which is running mssearch.exe process (SP_Search in my case) to local group called Performance Monitor Users. After adding the user I rebooted the machine and the problem went away.

2016-02-17

Shared Folder Permissions When Running Backup-SPFarm

I have setup a farm according to Medium Security Option on Vlad Catrinescu's blog. I setup a backup of this farm using Backup-SPFarm powershell script. If I grant read/write permissions to Everyone on shared folder everything works fine. But if I limit permissions only to SP_Admin account backup fails.

The solution is to grant the following accounts read/write permissions to shared folder:

  • SP_Admin 
  • SP_Services 
  • SQL_Services 

where SP_Admin is the user account which executes the script.

2015-12-22

NullReferenceException When Clicking a Task in Workflow Designer

The other day I was designing a Workflow (Workflow Manager technology) in Visual Studio 2012 when I stumbled upon on an exception when clicking on a SingleTask activity in Workflow Designer within Visual Studio. When I first click on a task I get "Communicating with SharePoint" dialog:


After Visual Studio establishes communication with SharePoint I end up with the following dialog:

Full exception stack trace is as follows:
-------------------------
Workflow Designer
-------------------------
NullReferenceException:
Object reference not set to an instance of an object.
-------------------------

Server stack trace:
   at Microsoft.VisualStudio.SharePoint.Designers.List.ModelAccess.SharePointSolutionModelStorage.GetAllFiles(ISharePointProject project)
   at Microsoft.VisualStudio.SharePoint.Designers.List.ModelAccess.SharePointSolutionModelStorage.Refresh(ISharePointProject project)
   at Microsoft.VisualStudio.SharePoint.Designers.List.ModelAccess.SharePointCompositeModelStorage.RefreshProjectModels()
   at Microsoft.VisualStudio.SharePoint.WorkflowDesignerSupport.ListInfoService.GetContentTypes(String BaseTypeId)
   at Microsoft.VisualStudio.SharePoint.WorkflowExtensions.SharePointListService.<GetWorkflowTaskContentTypes>b__10(IListInfoService service)
   at Microsoft.VisualStudio.SharePoint.WorkflowExtensions.SharePointListService.ConvertValues(Func`2 producer)
   at Microsoft.VisualStudio.SharePoint.WorkflowExtensions.SharePointListService.GetWorkflowTaskContentTypes()
   at System.Runtime.Remoting.Messaging.StackBuilderSink._PrivateProcessMessage(IntPtr md, Object[] args, Object server, Object[]& outArgs)
   at System.Runtime.Remoting.Messaging.StackBuilderSink.SyncProcessMessage(IMessage msg)

Exception rethrown at [0]:
   at System.Runtime.Remoting.Proxies.RealProxy.HandleReturnMessage(IMessage reqMsg, IMessage retMsg)
   at System.Runtime.Remoting.Proxies.RealProxy.PrivateInvoke(MessageData& msgData, Int32 type)
   at Microsoft.SharePoint.DesignTime.Activities.Design.Services.ISharePointListService.GetWorkflowTaskContentTypes()
   at Microsoft.SharePoint.DesignTime.Activities.Design.ContentTypesProvider.ProvideItems(ISharePointListService service)
   at Microsoft.SharePoint.DesignTime.Activities.Design.IndependentDataProvider`1.GetItems(ModelItem owner, PropertyValue propertyValue)
   at Microsoft.SharePoint.DesignTime.Activities.Design.SharePointItemChooserViewModel`1.GetItems(ModelItem Owner, PropertyValue PropertyValue)
   at Microsoft.SharePoint.DesignTime.Activities.Design.ChooserViewModel`1.PopulateItems()
   at Microsoft.SharePoint.DesignTime.Activities.Design.GenericChooser`2.SharePointBaseChooser_Loaded(Object sender, RoutedEventArgs e)
   at System.Windows.RoutedEventHandlerInfo.InvokeHandler(Object target, RoutedEventArgs routedEventArgs)
   at System.Windows.RouteItem.InvokeHandler(RoutedEventArgs routedEventArgs)
   at System.Windows.EventRoute.InvokeHandlersImpl(Object source, RoutedEventArgs args, Boolean reRaised)
   at System.Windows.EventRoute.InvokeHandlers(Object source, RoutedEventArgs args)
   at System.Windows.UIElement.RaiseEventImpl(DependencyObject sender, RoutedEventArgs args)
   at System.Windows.UIElement.RaiseEvent(RoutedEventArgs e)
   at System.Windows.BroadcastEventHelper.BroadcastEvent(DependencyObject root, RoutedEvent routedEvent)
   at System.Windows.BroadcastEventHelper.BroadcastLoadedEvent(Object root)
   at MS.Internal.LoadedOrUnloadedOperation.DoWork()
   at System.Windows.Media.MediaContext.FireLoadedPendingCallbacks()
   at System.Windows.Media.MediaContext.FireInvokeOnRenderCallbacks()
   at System.Windows.Media.MediaContext.RenderMessageHandlerCore(Object resizedCompositionTarget)
   at System.Windows.Media.MediaContext.RenderMessageHandler(Object resizedCompositionTarget)
   at System.Windows.Threading.ExceptionWrapper.InternalRealCall(Delegate callback, Object args, Int32 numArgs)
   at MS.Internal.Threading.ExceptionFilterHelper.TryCatchWhen(Object source, Delegate method, Object args, Int32 numArgs, Delegate catchHandler)
-------------------------


After a long debugging session of Workflow Designer I realized that my colleague accidentally deleted Package folder from SharePoint App project. I pulled the latest version and I didn't notice that folder was missing. When I restored the folder, Workflow Designer didn't throw any exceptions any more.

2015-12-03

Running a Project with Workflow in Provider-Hosted Add-In

While trying to run (F5 in Visual Studio) add-in project of provider-hosted add-in containing workflow I got this error in output window:

Microsoft.SharePoint.WorkflowServices
System.FormatException: RestrictAssociationToId   
 at Microsoft.SharePoint.WorkflowServices.DGWorkflowDeploymentProvider.PublishOrUpdateDefinitions(WorkflowServicesManager proxy, WorkflowDeploymentService deploymentService, Dictionary`2 oldDefinitionIdMap, Dictionary`2 newDefinitionIdMap, Dictionary`2 listIdDictionary)   
 at Microsoft.SharePoint.WorkflowServices.DGWorkflowDeploymentProvider.DeployOrUpgrade(WorkflowScopeIdentifier scopeId, SPWorkflowPart oldParts, SPWorkflowPart newParts, Dictionary`2 listIdDictionary)   
 at Microsoft.SharePoint.WorkflowServices.DGWorkflowDeploymentProvider.Deploy(WorkflowScopeIdentifier scopeId, SPWorkflowPart parts, Dictionary`2 listIdDictionary) StackTrace:
 at Microsoft.Office.Server.Native.dll: (sig=678c0f87-966f-4d99-9c94-b49e788d2672|2|microsoft.office.server.native.pdb, offset=131CE)
 at Microsoft.Office.Server.Native.dll: (offset=21BE5)


Turns out I didn't include target list and history list in the app feature. This caused aforementioned error while trying to deploy workflow during "Activate features" stage. As soon as I included the lists in the feature everything went ok.