In Sharepoint 2010, is it possible to submit an existing file?
Using only literal SOAP calls, is it possible to use RecordsRepository.SubmitFile to submit a file somewhere already on the Sharepoint Site? Currently I have code that can use Copy.CopyIntoItems to upload a doc into the dropoff library and fill all the necessary metadata fields including content type, but it doesn't seem to want to route into the destination library.
Do I have to re-submit the file as a byte stream to use this method? I would have to download the document, convert to base64 and reupload which doesn't seem ideal.
So now I tried using RecordsRepository.SubmitFile but all I ever get is a NotFound error. I followed this example. The request I send looks like this:
<SubmitFile xmlns="http://schemas.microsoft.com/sharepoint/soap/recordsrepository/">
<fileToSubmit />
<properties>
<RecordsRepo开发者_运维百科sitoryProperty>
<Name>ID</Name>
<Value>120</Value>
<Type>Counter</Type>
<Other />
</RecordsRepositoryProperty>
<RecordsRepositoryProperty>
<Name>ContentTypeId</Name>
<Value>
0x010100F61F2571157CF04CA067909F68034A00004471681EEFE6FD4EA87735A0F54C2908</Value>
<Type>ContentTypeId</Type>
<Other />
</RecordsRepositoryProperty>
<RecordsRepositoryProperty>
<Name>ContentType</Name>
<Value>Routing Documents</Value>
<Type>Text</Type>
<Other />
</RecordsRepositoryProperty>
<RecordsRepositoryProperty>
<Name>Created</Name>
<Value>3/14/2011 6:18:53 PM</Value>
<Type>DateTime</Type>
<Other />
</RecordsRepositoryProperty>
<RecordsRepositoryProperty>
<Name>vti_modifiedby</Name>
<Value>ADOMAIN\auser</Value>
<Type>String</Type>
<Other />
</RecordsRepositoryProperty>
</properties>
<recordRouting>Routing Documents</recordRouting>
<sourceUrl>http://site.domain.ad.example.com/sites/mysite/recordc/DropOffLibrary/NM_1_XYZ - herp derp derp.doc</sourceUrl>
<userName>ADOMAIN\auser</userName>
</SubmitFile>
Yes, you do have to supply the byte stream when using the official file web service.
It would be kinda weird otherwise; how would it handle different authentication situations for instance. Also this WS is made for a generic approach; any applicatiaon in- or out-of SharePoint should be able to use it.
http://www.sharepointdev.net/sharepoint--development-programming/notfound-error-while-sending-a-document-to-records-center-programmatically-62025.shtml
FTA:
There is a group called "Records Center Web Service Submitters for recordcenter" whic hbasically specifies the users allowed to submit a record to the record center via the web service. By default, nobody is a member of this group. To add a user go to "Records Center >Peoples and Groups>Groups" and click on the above mentioned group. Add the user to this group, and the above code works....
精彩评论