2013-05-27 42 views

回答

0

使用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