Beispiel #1
0
 public static Post QueryPostDetail(string postTitle, string category)
 {
     try
     {
         Post post = new Post();
         Microsoft.SharePoint.Client.ListItemCollection coll = DAT.DataQuery.QueryListItems(string.Format(PostModel.postsSiteUrl, category), PostModel.postsListName, string.Format(PostModel.postDetailCamlQueryByTitle, postTitle));
         if (coll.Count > 0 && coll[0] != null)
         {
             SP.ListItem item = coll[0];
             post.Id = Convert.ToInt32(item["ID"]);
             SP.FieldUserValue author = (SP.FieldUserValue)item["Author"];
             post.Author        = author.LookupValue.ToString();
             post.Title         = postTitle;
             post.Body          = HLP.TransformHtmlStringForGlobalAsax(item["Body"].ToString());
             post.PublishedDate = Convert.ToDateTime(item["PublishedDate"]);
             post.CategoryName  = category;
         }
         return(post);
     }
     catch (Exception)
     {
         throw;
     }
 }