Nintex Connect

The Official Community Site for Nintex Software Products, including Nintex Workflow 2007, 2010 and 2013; Nintex Workflow for Project Server 2010; Nintex Reporting 2008 and Nintex Analytics 2010; Nintex Forms 2010; Nintex Live and Nintex SmartLibrary.
Welcome to Nintex Connect Sign in | Join | Help
in Search

Copy document using copy web service

Last post 08-18-2011, 2:27 PM by Vadim_Tabakman. 5 replies.
Sort Posts: Previous Next
  •  08-15-2011, 12:03 PM 18756

    Copy document using copy web service

    Hi,

    In my workflow - When user creates a new list item, he/she attaches a document (lets call it doc A) to it. This document (doc A) is edited all along the workflow life cycle by different users. In the end, I wish to copy doc A to another document library. 

    First I extracted URL of the attachment using http://connect.nintex.com/forums/thread/7612.aspx and then I tried using "Copy an item" .. but there is no way you can give URL as source of the document.

    Then I tried using Copy web service - I am using CopyIntoItemsLocal function. My SOAP looks like this:

    <?xml version="1.0" encoding="utf-8"?>
    <soap:Envelope xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/">
        <soap:Body>
            <CopyIntoItemsLocal xmlns="http://schemas.microsoft.com/sharepoint/soap/">
                <SourceUrl>{WorkflowVariable:SourceUrl}</SourceUrl>
                <DestinationUrls>http://sp-site/sandbox/Documents/PolicyDocuments</DestinationUrls>
            </CopyIntoItemsLocal>
        </soap:Body>
    </soap:Envelope>

     Where SourceURL is "set a variable" to URL I extracted using another web service (above link) and since my destination folder is always going to be same - I hardcoded it to the folder level. When I execute, it does'nt throw me any error, but does not copy the file to desired folder either. It completes with no error.

    As a test, I tried hard coding URL of another document (in Documents Library) as source URL, but won't work either. Whats going wrong ?

     Thanks !

  •  08-15-2011, 1:41 PM 18757 in reply to 18756

    Re: Copy document using copy web service

    Hi pratz09,

    I think you may be missing the <string> node.

    Try:

    <DestinationUrls><string>http://sp-site/sandbox/Documents/PolicyDocuments</string></DestinationUrls>

  •  08-17-2011, 4:49 PM 18842 in reply to 18757

    Re: Copy document using copy web service

    Yep. Works fine now.Thanks !

    I would like to ask one more thing, if I may.

    Now, I just want to extract the filename from AttachmentURL. I will be comparing filename against Titles of a document library to find a match. How to strip out just the filename without even any extension (like doc or xls) ?

    Thanks.

  •  08-17-2011, 5:33 PM 18845 in reply to 18842

    Re: Copy document using copy web service

    Hi pratz09,

    I'd recommend looking at the Regular Expression action.

    I think you could possible build an expression like this :

    [a-zA-Z]+.[a-zA-Z]+

    I haven't tried this.  Just off the top of my head, so you'll probably need to play with that.

  •  08-18-2011, 2:09 PM 18865 in reply to 18845

    Re: Copy document using copy web service

    Hi Vadim,

    Thanks a lot ! I am playing with it, got closer, but these ';' symbols are bothering me. When I pass a URL, how does these ';' symbols appear, they were nowhere in the URL.

     

    I appreciate your help.

  •  08-18-2011, 2:27 PM 18867 in reply to 18865

    Re: Copy document using copy web service

    Hi pratz09,

    aahhhh yeah I forgot about that :)

    So the "Extract" part of the Regular Expression action only allows you to store the results in a Collection variable.  When you use that variable as a text, it separates the contents by a semi-colon.  Even if there is one item in there.

    It'll be :

    Item;

    So what I would suggest is create a text variable (textResult) and a number variable (numIndex).

    Then after the Regular Expression action, have a Collection Operation action that does a Get on the collection, index is the numIndex variable (which will be 0 - first entry) and store the result in your text variable (textResult).

    Then use your textResult variable where you need it.  There should be no semi-colon in it.

View as RSS news feed in XML
Powered by Community Server, by Telligent Systems