0
我需要一些幫助,也許有人面臨類似的任務。 我想使用SharePoint 2010 Web服務查找狀態爲「錯誤發生」的所有工作流。 我想知道這個任務可能嗎? 謝謝。使用SharePoint Web服務獲取工作流狀態
我需要一些幫助,也許有人面臨類似的任務。 我想使用SharePoint 2010 Web服務查找狀態爲「錯誤發生」的所有工作流。 我想知道這個任務可能嗎? 謝謝。使用SharePoint Web服務獲取工作流狀態
使用CAML,您可以使用Web服務進行查詢。
WorkflowStatus = 3(發生錯誤)使用方法GetListItems和CAML查詢。
public XmlNode _nodes;
string _ListID = "";
string _ViewID = "";
XmlDocumento _xmlDoc = new System.Xml.XmlDocument();
XmlElement _query = _xmlDoc.CreateElement("Query");
XmlElement _queryOptions = _xmlDoc.CreateElement("QueryOptions");
XmlElement _viewFields = _xmlDoc.CreateElement("ViewFields");
_query.InnerXML = @"
<Where>
<Eq>
<FieldRef Name='WorkflowNameColumn' />
<Value Type='WorkflowStatus'>3</Value>
</Eq>
</Where>";
_queryOptions.InnerXml = "<QueryOptions> <IncludeMandatoryColumns>FALSE</IncludeMandatoryColumns></QueryOptions>";
_viewFields.InnerXml = "";
// SharepointListWS is the name i use in Web References
SharepointListsWS.Lists _lst = new SharepointListsWS.Lists();
_nodes = _lst.GetListItems(_listID, _ViewID, _query, _viewFields, "300", _queryOptions, null);
foreach (XmlNode node in _nodes) {
if (node.Name.ToLower() == "rs:data") {
for (int i = 0; i < node.ChildNodes.Count; i++) {
if (node.ChildNodes[i].Name.ToLower() == "z:row") {
// you can debug here
XmlNode AllNodes = node.ChildNodes[i];
// Find at Attributes
for (int a = 0;a < AllNodes.Attributes.Count; a++) {
string field = AllNodes.Attributes[a].Value.Trim();
string name = AllNodes.Attributes[a].Name;
string colName = XmlConvert.DecodeName(name).ToLower().Replace("ows_", "");
}
}
}
}
}
狀態列表可以找到here。