Saving a document in SharePoint online

Last updated 2018-03-16 13:24:56 UTC

A proxy service is available that simplifies communications to SharePoint Online to store AssureSign documents. This service can be invoked via a DocumentTRAK notification.

Once the DocumentTRAK communication is invoked, the proxy service authenticates with your SharePoint credentials and saves the document being passed in the library you specify. This can be invoked based on special parameters passed from a Submit of a document through our solution for Dynamics CRM (available from our solution release, but this proxy service may be configured on any other AssureSign template you design.

Creating the Notification

While logged into your AssureSign account, go to the Notifications\DocumentTRAK editor on the Administration tab. Create a new Completed Document Transmission.

Give your notification a unique Design Name, and set the "Service Endpoint (URL)" to:

[the assuresign root URL]/Custom/SharepointDocumentTrakProxy/SharepointDataFileHandler.ashx

Modify the bracketed section of the address to be the root URL of the AssureSign instance you log into. For a sandbox account, the complete service address will be:

The other settings should be configured as follows:

  • Enable Basic HTTP Authentication? Yes
  • Design Used for Authentication? None
  • Is this a SOAP-based service? No
  • SOAP Action: leave empty

Then click Next ...

For Authentication Credentials, enter the Username and Password for a user of your SharePoint online instance that has rights to save files in the library you specify.

Since this communication is merely a proxy service, it is not really using basic HTTP authentication. These encrypted credentials will merely be passed along to the proxy service which will handle the login process necessary to invoke SharePoint web methods.

Click Next to continue ...

In Request Message XML, select "Paste Raw XML".

Click Next to continue ...

Use the following XML as a template, and replace the {items in curly braces} with valid values:

<SharepointDocumentTRAKRequest Username="[Authentication - Username]" Password="[Authentication - Password]" SharepointURL="{your SharePoint online root URL}" Library="{folder1/folder2/etc...}" FileName="{provide a unique name here}.pdf" FileContents="[Completed Document]"></SharepointDocumentTRAKRequest>

For example, if the external address of your SharePoint instance is, you want to store the document in the library, and you would like to use the merge field for the document name that was passed in then the XML should be:

<SharepointDocumentTRAKRequest Username="[Authentication - Username]" Password="[Authentication - Password]" SharepointURL="" Library="account/signeddocuments" FileName="[Document Name].pdf" FileContents="[Completed Document]"></SharepointDocumentTRAKRequest>

The other bracketed strings still present in the XML are merge fields.

Important: If you are pushing a document to a SharePoint sub-site, the site portion of the address should be included as part of the SharepointURL.  For example, if the site address is and the full path to the library is then the XML should be:

<SharepointDocumentTRAKRequest Username="[Authentication - Username]" Password="[Authentication - Password]" SharepointURL="" Library="documentstorage" FileName="[Document Name].pdf" FileContents="[Completed Document]"></SharepointDocumentTRAKRequest>

If you submitted the document through the Dynamics CRM AssureSign solution, and your configuration allows passing of SharePoint storage location information, then the solution passes additional parameters that are intended to be used for saving the document in SharePoint. These parameters are:

  • AssureSignCRM:SharepointURL
  • AssureSignCRM:Library

Note: You must enable "Store Completed Document in SharePoint" on your AssureSign Configuration in CRM for these extra parameters to be passed. If set to Yes, when the AssureSign Document record form is used to submit, you will be able to select from SharePoint storage locations of entities related to the AssureSign Document record. You may also set these values in workflow processes configured to submit to AssureSign.

If these will be present on the template you will use this DocumentTRAK design on, then the previous example could be adjusted:

<SharepointDocumentTRAKRequest Username="[Authentication - Username]" Password="[Authentication - Password]" SharepointURL="[AssureSignCRM:SharepointURL]" Library="[AssureSignCRM:Library]" FileName="[Document Name].pdf" FileContents="[Completed Document]"></SharepointDocumentTRAKRequest>

It is also possible, as with any other DocumentTRAK design, to use advanced javascript data manipulation for a more complete solution. For example, the following altered XML will use the passed CRM parameters if they are present, but in case the template is used for non-CRM submitted documents it will use alternate values. In addition, the document name will be altered with a timestamp to ensure it is unique:

<SharepointDocumentTRAKRequest Username="[Authentication - Username]" Password="[Authentication - Password]" SharepointURL="[{var u = parameter('AssureSignCRM:SharepointURL'); return (!u|| 0 === u.length)?'':u;}]" Library="[{var l = parameter('AssureSignCRM:Library'); return (!l|| 0 === l.length)?'SignedDocuments':l;}]" FileName="[Document Name].signed.[{formatDate(get('Completion Date'), 'YYYY-MM-DD_hh-mm-ss')}].pdf" FileContents="[Completed Document]"></SharepointDocumentTRAKRequest>

Click Next to continue ...

In Response Validation Method, select "Compare response to expected XML string", click Next, select "Paste Raw XML" and click Next again.
Enter the string


Click Next, and then Finish to save

Add the Notification to Templates

Modify your templates as follows to use your DocumentTRAK notification:

For existing templates, select Edit on the Existing template to be modified. Then, Select Edit Workflow.
On "Document Transmission", select "New" and pick this design from the "Design Name" list.

Save after making your selection.

It is important to note that any time your template is used it will attempt to perform this DocumentTRAK notification.

Configure you Account Notification Preferences

You will want to configure the DocumentTRAK Retry Policy and the Account Technical Contacts, which are set globally on your account.

SharePoint Storage Restrictions

The user credentials used to connect to SharePoint must have access to write to the document library. The document will overwrite the file if a file with the same name already exists. The document library must already exist; the process will not attempt to create a new folder in SharePoint.

SharePoint files (or folders) cannot contain any of the following characters:

~ # % & * { } \ : < > ? / | “

It would be possible to strip out illegal characters if they might exist in what you are attempting to write out to SharePoint with some javascript in the design.  For example, the following modified version of the previous examples includes a regular expression replacement of these characters in the file name:

FileName="[{get('Document Name').replace(/[~#%&*:<>?|“"\{\}\\\/]/gi, '')}].signed.[{formatDate(get('Completion Date'), 'YYYY-MM-DD_hh-mm-ss')}].pdf"
Have more questions? Submit a request