Creating SharePoint Folder automatically – Custom Plugin Code

Requirement:

We had a requirement for creating SharePoint Folder automatically when we create a record in D365 CRM Online. We tried lot of workarounds but could not get a concrete solution

PS: The Automatic Folder creation option in Document Management settings does not actually create the folder when the record is created. It only creates when you navigate to the Documents area for the first time without asking.

Solution:

Finally Thanks to the Legend – Mr. Scott Durow, we could do this with the Code that he has shared on MSDN Code Samples.

Details on the blog: http://develop1.net/public/post/SharePoint-Integration-Reloaded-e28093-Part-3.aspx

MSDN Code Samples: https://code.msdn.microsoft.com/SharePoint-Integration-c5f21604

 

What I did:

This is what I did to make it run:

  1. Create a new Class Library and add all the files from the MSDN Samples.
  2. Update the GetSecureConfig function to include the credentials of the SharePoint administrator.
  3. Deploy this assembly using the Plugin registration tool.
  4. Then you can use it as Custom workflow as also mentioned in the blog link above.

 

Note: Please post your comments below in case of queries/ edits.

4 thoughts on “Creating SharePoint Folder automatically – Custom Plugin Code

  1. Did you have to update his code to get it to work? I am having a difficult time getting the code to work. I have tried all the updates mentioned on the page with the code.

    Liked by 1 person

    1. Did you follow what updates I did on my blog? Actually I did not use the project as it is. I created a new class library, added all the files and references from the site. Then I updated the password in the function (see the blog, it has details) and used the class library as a Custom Workflow action

      Liked by 1 person

      1. Yes, I copied the code out into a new library. (His project doesn’t even open for me in visual studio because of compatability issues.) Then I added a username and password. I also added a deserialization method to resolve an issue getting the auth url. As far as I can tell this now works as it fetchs the correct auth url. I get an error on the GetAdfsSAMLTokenUsernamePAssword function. And the call returns the error:

        “The remote serve returned an error: (415) Cannot process the message because the content type ‘application/soap+xml; charset=utf-8’ was not the expected type ‘application/soap+xml; charset=utf-8’..”

        Like

  2. The only thing I would like to change in this implementation is for the username and password not be hard coded. If the admin changes his password, the code has to be changed. Any suggestion ? Thanks.

    Liked by 1 person

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s