Create document links

I need to use WF to build a shadow library containing logical links to all documents in a given document library. (New document in /Documents --> create link to document in /Links).
The /Links library has only one Content type active, which is based on the Link to a Document -content type.

Using the basic SP 2013 WF action “Create item in …” I get a file, but the .aspx file generated is blank!

My hopes went up when I discovered your new action pack.
But I can not get it to work here either. Tried

  1. Using the “Create item in list …” action.
    It returns an error message saying: Exception: To add an item to a document library, use SPFileCollection.Add().
  2. Using the “Copy document from …” action
    It creates a file, but it is also blank (the .aspx content for logical links is not generated).
    I also can not find a way to enter the specific metadata required by the link content type.

Appreciate tips on how to approach this challenge.

Hi,

Thank you for your question.

The document link is not a list item, but document actually. That is why the issue occurs. We are analyzing the ways do this for your case right now

We will provide more information on Monday.

Hello Geir,

Sorry for delay with answer. I wanted to ensure that the solution will work.
At screenshot below you can see the full workflow.

The workflow copies template aspx file (in attachment to this message) from Assets library to document library and changes the attributes: URL and ContentType.


The CAML Query:

<View Scope='RecursiveAll'> <Query> <Where><Eq><FieldRef Name='FileRef' /><Value Type='Lookup'>/sites/Dev/Shared Documents/[%Variable: NewFileName%]</Value></Eq></Where> </Query> </View>

Variables:
[ul]
[li]TemplateURL: [%Workflow Context:Current Site Url%]SiteAssets/Template.aspx[/li]
[li]NewFileURL: [%Workflow Context:Current Site Url%]Shared%20Documents/[%Variable: NewFileName%][/li][/ul]
Sample PoC.zip (4.75 KB)

Also if the solution above don’t satisfy you. We can add a new workflow action “CreateTextFile”, if you’re interested please write to sales@plumsail.com for request the price.

Thanks for your response, and the suggested solution.
I have rebuild it but can not get the CAML query to return any data.
Here is my version of your query:

[/<View Scope='RecursiveAll'>  
    <Query> 
	<Where>
	<Eq>
	    <FieldRef Name='FileRef' />
	        <Value Type='Lookup'>Scanship/production/Links/[%Variable: NewFileName%]</Value>
	</Eq>
	</Where> 
    </Query> 
</View>

The list has URL: scanship.sharepoint.com/Scanshi … ion/Links/

The WF action setup looks like this:
Folder URL: /Scanship/Production
CountItems: Variable: count
List URL: Links
Caml Query (as above)
Items: Variable: Items (=dictionary)

Logging content of variable: count returns:
02.01.2015 10:08 Comment Item: [] - 0
… and nothing is inserted into variable ItemID.

Any idea what I do wrong?
Thanks

NB!
I have also tried various other CAML queries, f ex inserting a given key into the Title field, and querying for this. But same - or no results on this either.
Ex:

Ex 1:
<View Scope='RecursiveAll'>  
    <Query> 
	<Where>
	<Eq><FieldRef Name='Title' />
	<Value Type='Lookup'>[%Variable: FileRef%]</Value>
	</Eq>
	</Where> 
    </Query> 
</View>

Ex 2:
<View Scope='RecursiveAll'>  
    <Query> 
	<Where>
	<Eq>
	         <FieldRef Name='FileLeafRef' />
	         <Value Type='File'>D1.aspx</Value>
	</Eq>
	</Where> 
    </Query> 
</View>

Try to check your CAML query via CAML Designer it very useful tool for debugging.

Also the parameter “Folder URL” is optional you can try leave it blank.

Please let me know about the result.

Hi again*
If I remove FolderURL, I receive error in WF log:
Exception: The ‘query.FolderServerRelativeUrl’ argument is invalid.

I am using CAML Designer, and it works fine, for ex

<Where> <Eq> <FieldRef Name='Title' /> <Value Type='Text'>90D1</Value> </Eq> </Where>

But I can not find a way to test your query, containing field Fileref, on a lookup field.

Hi,
We’ve fixed error with FolderServerRelativeUrl, could you try to run your workflow again?

Same result. No Items found by CAML, and WF hangs in step “Update Link URL” (must be manually terminated).

Do I need to reinstall the Action pack to pick up the changes?
I believe I have not installed the latest SW update you released to the action pack.
Can this have an impact?

Thanks
Geir

It should work without upgrade the package.

I want help you, can we setup screen sharing session via TeamViewer?

Thanks for effective debugging help today, Roman.

Thing to remember is that WF variable CurrentItem:Name does not include file suffix (here: .aspx)
AND
Trying to print values from a dictionary variable using the Log action results in the WF stopping execution.

You guys build really useful features and provide excellent help and support.
Thanks!
Geir