Sunday, December 9, 2012

How to copy the Document Library Properties to the Custom List for SharePoint using Workflow - copy the document Type (icon) and URL

Step 1: Create a Document Library:

Document Library A

Step 2: Create a new Column at the Document Library A as follows:

Read Only Permission (People) - provide the read only permission to the document.

Step 3: Create a Custom list which have the same Column Name & Settings as the Document Library A.

Custom List A

Step 4: Create a new Column in the Custom List A:

File (Hyperlink or Picture) - Format URL as Picture
Document URL (Hyperlink) - provide document URL from Document Library A

Step 5: Create a SharePoint Designer Workflow to run when a new documents added to the Document Library A.

Step 6: On the same Workflow, add a Impersonation Step and a code to to set the read only permission for the document base on Read Only Permission Column.

Step 7: On the same Workflow, added a code to copy the properties (Create New List Item) of the Document Library to the Custom List.

Step 8: On the same Workflow, added a code to copy the URL of the document to the Custom List A.




















Step 9: On the same Workflow, add a new Workflow Local Variables:

Typeoffile (string) - to temp store the icon URL

Step 10: On the same Workflow, added a code to copy the Type (icon linked to document) with the Code A to the Typeoffile (string). Then, add a code to update the item at Custom List A.

Code A: /_layouts/images/ic[%Current Item:Type%].gif















Step 11: Test the workflow by adding a new document to the Document Library A. The workflow will run and do the following actions:
  1. Change the Document Permission based on Read Only Permission (People) Column.
  2. Copy the Document Properties to the Custom List. Then set the Document URL value and Type of File (Picture) value in custom list based on Document Library A.

No comments:

Post a Comment