This SharePoint tutorial, we will discuss how to resolve an error The type or namespace WorkflowServicesManager could not be found in SharePoint.
The error comes in a console application developed to work with workflows in SharePoint Online. In that online, I was trying to retrieve workflows presented on the site.
The code was like below:
using (ClientContext ctx = new ClientContext(URL))
{
ctx.AuthenticationMode = ClientAuthenticationMode.Default;
ctx.Credentials = new SharePointOnlineCredentials(GetSPOAccountName(), GetSPOSecureStringPassword());
ctx.Load(ctx.Web);
ctx.ExecuteQuery();
var workflowServicesManager = new WorkflowServicesManager(ctx, ctx.Web);
}
But it gave an error in the below line:
var workflowServicesManager = new WorkflowServicesManager(ctx, ctx.Web);
The error looks like:
The type or namespace WorkflowServicesManager could not be found (are you missing a using directive or an assembly reference?).
The type or namespace WorkflowServicesManager could not be found
We need to add the Microsoft.SharePoint.Client.WorkflowServices.dll inside our console application. We can add the dll reference from NuGet.
Right-click on References folder in the solution explorer -> Manage NuGet Packages….
Then in the NuGet Package Manager search for “Microsoft.SharePoint.Client.WorkflowServices” and then Install like below:
Once successfully installed the dll, you should be able to add the using statement like below:
using Microsoft.SharePoint.Client.WorkflowServices;
You may like following SharePoint workflow tutorials:
- How to add edit task form URL inside SharePoint 2013 designer workflow email?
- Create SharePoint Workflow History list using csom programmatically
- Workflow App Identifier in SharePoint Online App Permissions
- SharePoint Hosted Add-in: Send Email to SharePoint group using visual studio workflow
- SharePoint Hosted Add-in: Send Email using visual studio workflow
- Activate Workflows can use app permissions Feature programmatically using C#.Net .net managed object model code
- An unhandled exception occurred during the execution of the workflow instance. The format of the URI could not be determined
- An unhandled exception occurred during the execution of the workflow instance. Exception Details: System.ArgumentException AssignedTo
- Call Web API from SharePoint Online using httpsend workflow activity
In this SharePoint tutorial, we learn how to fix error The type or namespace WorkflowServicesManager could not be found which comes while working with csom in SharePoint Online.
Bhawana Rathore is a Microsoft MVP (3 times in Office Apps & Services) and a passionate SharePoint Consultant, having around 10 years of IT experience in the industry, as well as in .Net technologies. She likes to share her technical expertise in EnjoySharePoint.com and SPGuides.com