Skip to main content
Hi,

I have got a process where user uploads a file to a SPS library 'Documents for Approval' to a specific folder (created manually before) and the process goes for several approvals to different people then. After the last one has approved it I need to move the documents from DocAttachment field to a new library 'Approved Docs'. If I use a Multiple Documents SharePoint event it allows me to select a library but not a folder. And as I can understand this event will not create a folder in the new library and will raise an error "File not exists'. I need to create a folder in a new library named as a user's folder (if not exists).
Can anybody help me how can I solve this problem?
Thanks
Hi,

Did you find an answer to this query?

Can you create a folder in a SPS Library from a K2 Event?

:?

Best Regards
Hi,

I found a solution to use WebService Event and use http://Server_Name/_vti_bin/Dws.asmx as a webservice, but it just do nothing ... no errors but no created folder either.. I wonder why ..
Waiting for the answer to my ticket from K2 Support.. if any information I'll let you know

regards,
Andrei
Well, I'm trying to do it using code in Visual Studio:

Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
Dim a As String
Dim MyWebService As New datcserver.Dws
Dim credentials As System.Net.NetworkCredential = New System.Net.NetworkCredential("MyName", "MyPassword", "MyDomain")
Dim mycredentialCache As System.Net.CredentialCache = New System.Net.CredentialCache
mycredentialCache.Add(New Uri(MyWebService.Url), "Negotiate", credentials)
mycredentialCache.Add(New Uri(MyWebService.Url), "NTLM", credentials)
mycredentialCache.Add(New Uri(MyWebService.Url), "BASIC", credentials)
mycredentialCache.Add(New Uri(MyWebService.Url), "Digest", credentials)
MyWebService.Credentials = mycredentialCache
a = MyWebService.CreateFolder("http://datcserver/sites/cyprus/Shared Documents/Test")
K2TextBox1.Text = a

End Sub

When I run it, no folder is created and Textbox contains error code - <Error ID="10">j</Error> - it means "The parent folder does not exist"
But http://datcserver/sites/cyprus/Shared Documents exists! And I can load it.
Can anybody help?
As far as I research this topic, the code above is OK to create a folder in a library of a default DWS site. It means that if my root SPS site URL is http://datcserver, it operates with document libraries located on this site.
Thus, the question is transformed how to change the settings for the site, because I need to create a folder not in the defualt site, i.e. for example http://datcserver/sites/MySite/Shared Documents. - In this case code returns error - Folder not found (if i set "http:// ..." as a string url parameter).

Thanks
Well, if anybody is still interested in this thread 🙂 I have the solution.
My mistake was to call a webservice from the Default IIS site. But to create a folder in a library that belongs not to defalut site I need to copy webservice files to the directory under the new site.
icon-quote.gifwebber77:
Well, if anybody is still interested in this thread 🙂 I have the solution.
My mistake was to call a webservice from the Default IIS site. But to create a folder in a library that belongs not to defalut site I need to copy webservice files to the directory under the new site.


SharePoint works by getting its current context & working from there. Therefore, if you want to use the SharePoint web services but for one of your subsites then you can reference the web services using the subsite URL, e.g. http://datcserver/sites/MySite/_vti_bin/Dws.asmx

There's no need to copy the files there as the URLs are practically all virtual anyway 🙂 It's just that whatever is available at the top level of sharepoint is also available to subsites too, just amend your URL to include the subsite address in the middle too, as above.

Reply