Wednesday, March 31, 2010

SharePoint Web Service(5)--Make use of the return XML

When you use the web service to manipulate, like add a new item or update a item list. After processing, the server would return a value which is a XML code snippet. In this XML code snippet, you can get a lot of information you need.
<Results xmlns="http://schemas.microsoft.com/sharepoint/soap/">
<Result ID="1,New">
<ErrorCode>0x00000000</ErrorCode>
<ID />
<z:row
ows_ContentTypeId="0x010018A5A22ED24FAB4792BD45362AF5FFC3"
ows_Title
="My Test Item"
ows_ID
="20"
ows_ContentType
="Item"
ows_Modified
="2009-05-10 10:03:46"
ows_Created
="2009-05-10 10:03:46"
ows_Author
="1;#SERVER\Administrator"
ows_Editor
="1;#SERVER\Administrator"
ows_owshiddenversion
="1"
ows_WorkflowVersion
="1"
ows__UIVersion
="512"
ows__UIVersionString
="1.0"
ows_Attachments
="0"
ows__ModerationStatus
="0"
ows_LinkTitleNoMenu
="My Test Item"
ows_LinkTitle
="My Test Item"
ows_SelectTitle
="20"
ows_Order
="2000.00000000000"
ows_GUID
="{FAA08466-1760-4BCA-B74F-020649D16A97}"
ows_FileRef
="20;#sites/testsite/Lists/Test List/20_.000"
ows_FileDirRef
="20;#sites/testsite/Lists/Test List"
ows_Last_x0020_Modified
="20;#2009-05-10 10:03:46"
ows_Created_x0020_Date
="20;#2009-05-10 10:03:46"
ows_FSObjType
="20;#0"
ows_PermMask
="0x7fffffffffffffff"
ows_FileLeafRef
="20;#20_.000"
ows_UniqueId
="20;#{FDB8F26B-43DD-489C-9954-F49EE9BF3942}"
ows_ProgId
="20;#"
ows_ScopeId
="20;#{5556EA28-8789-47EA-A748-805FCAFB433A}"
ows__EditMenuTableStart
="20_.000"
ows__EditMenuTableEnd
="20"
ows_LinkFilenameNoMenu
="20_.000"
ows_LinkFilename
="20_.000"
ows_ServerUrl
="/sites/testsite/Lists/Test List/20_.000" ows_EncodedAbsUrl="http://server/sites/testsite/Lists/Test%20List/20_.000"
ows_BaseName
="20_"
ows_MetaInfo
="20;#"
ows__Level
="1"
ows__IsCurrentVersion
="1"
xmlns:z
="#RowsetSchema" />
</Result>
</Results>
When you create a new item in a list, and you want to know the new ID for this item. You can see there is a attribute named ows_ID, this is the ID for the new item. In addition, you can get some basic information about the list and the item. There is a Errorcode attribute, when the operation is successful, the Errorcode would be zero. When error comes up, you can check the Errorcode and error information here.

No comments:

Post a Comment