예제 #1
0
        /// <summary>
        /// This method will set scope attribute in query
        /// </summary>
        /// <param name="camlQuery">CamlQuery</param>
        /// <param name="scope">Scope option</param>
        public static void SetViewAttribute(this CamlQuery camlQuery, QueryScope scope)
        {
            //if Query ViewXml is Empty then create View root Node
            if (string.IsNullOrEmpty(camlQuery.ViewXml))
                camlQuery.ViewXml = VIEW_QUERY;

            //Load ViewXml
            XmlDocument xmlDoc = LoadViewXml(camlQuery.ViewXml);

            //Add scope attribute to root element
            XmlElement viewNode =(XmlElement)GetXmlNodeByXPath(VIEW_XPATH, xmlDoc);
            if (viewNode != null)
                viewNode.SetAttribute("Scope", scope.ToString());

            //Update ViewXml
            UpdateCamlQuery(camlQuery, xmlDoc);
        }
        /// <summary>
        /// This method will set scope attribute in query
        /// </summary>
        /// <param name="camlQuery">CamlQuery</param>
        /// <param name="scope">Scope option</param>
        public static void SetViewAttribute(this CamlQuery camlQuery, QueryScope scope)
        {
            //if Query ViewXml is Empty then create View root Node
            if (string.IsNullOrEmpty(camlQuery.ViewXml))
            {
                camlQuery.ViewXml = VIEW_QUERY;
            }

            //Load ViewXml
            XmlDocument xmlDoc = LoadViewXml(camlQuery.ViewXml);

            //Add scope attribute to root element
            XmlElement viewNode = (XmlElement)GetXmlNodeByXPath(VIEW_XPATH, xmlDoc);

            if (viewNode != null)
            {
                viewNode.SetAttribute("Scope", scope.ToString());
            }

            //Update ViewXml
            UpdateCamlQuery(camlQuery, xmlDoc);
        }
예제 #3
0
 /// <summary>
 /// Specifies which Web sites to include in the query as specified by the Scope attribute.
 /// </summary>
 /// <param name="scope">specifies the query scope</param>
 public static string Webs(QueryScope scope)
 {
     return Tag(CamlConst.Webs, null, CamlConst.Scope, scope.ToString());
 }
예제 #4
0
 /// <summary>
 ///     Specifies which Web sites to include in the query as specified by the Scope attribute.
 /// </summary>
 /// <param name="scope">specifies the query scope</param>
 /// <returns>a new CAML Webs element</returns>
 public static string Webs(QueryScope scope)
 {
     return(Base.Tag(Resources.Resources.Webs,
                     new XAttribute(Resources.Resources.Scope, scope.ToString())).ToStringBySettings());
     //return Tag(Resources.Webs, null, Resources.Scope, scope.ToString());
 }