开发者

Last modified person's user ID with MOSS List Service

Can you please let us know if it is possible retrieve user ID of the person who last mo开发者_开发技巧dified a document using MOSS list web service? If yes, please let me know the column name.


Each item has a Modified property, as well as a Modified By field, which respectively have Modified and Editor as their Internal field names. SO yes you can view who modified a document last and when that modification was done.

The CAML for the ViewFields would be

<ViewFields>
  <FieldRef Name='Modified' />
  <FieldRef Name='Editor' />
</ViewFields>

So placing this in the MSDN example on the GetListItems documentation page woulbe become:

SrvRef.Lists listService = new Web_Reference_Folder.Lists();
listService.Credentials= System.Net.CredentialCache.DefaultCredentials;

XmlDocument xmlDoc = new System.Xml.XmlDocument();

XmlNode ndViewFields = xmlDoc.CreateNode(XmlNodeType.Element,"ViewFields","");
ndViewFields.InnerXml = "<FieldRef Name='Modified' /><FieldRef Name='Editor' />";
// maybe add a Where clause as well to retrieve specific items only
// XmlNode ndQuery = xmlDoc.CreateNode(XmlNodeType.Element,"Query","");
// ndQuery.InnerXml = "<Where><ADD PREDICATES HERE</Where>";

try
{

  XmlNode ndListItems = listService.GetListItems("LISTNAME", null, null, ndViewFields, null, null, null);
  // do something with the result
}
catch (System.Web.Services.Protocols.SoapException ex)
{
  MessageBox.Show("Message:\n" + ex.Message + "\nDetail:\n" + ex.Detail.InnerText + "\nStackTrace:\n" + ex.StackTrace);
}
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜