Skip to main content
Hello all,

I want to know can we, once a user decides to attach a document to a Smartform with the K2DocAttachment control, create a folder in a SharePoint library and copy the newly attached document into that new folder? + The folder name should come from an XML Field.

The approach I'm thinking is forcing the attached document to copy itself in a temporary Sharepoint document library and then, before the next activity, insert events that will create de new SPS folder and move the document. Insert, afterwards, the new URL in the activity's SmartForm for user to click on it's hyperlink to get the file. Is this the right path? Or am I totally off course?

Thanks,
Hi,

All you need is just to put a Webservice Event in K2 Studio or add a webreference in Visual Studio and use DWS webservice (usually locates under _vti_bin/DWS.asmx) to create a new folder. This webservice contains a method CreateFolder which will create a folder in your library.

Regards,
u can also use the below code. K2 uses the same class to upload docs

K2SPSList SpsList = new K2SPSList();

if (! (SpsList.CreateFolder(DestSite.ToString(),DestFolder + "/" + Convert.ToString(K2.ProcessInstance.ID),ref ErrorMessage))) {
// Error Occurred in CreateFolder - Raise Error
throw new System.Exception(ErrorMessage);
}

Reply