Sitecore.Modules.WeBlog.MetaBlogApi.getPost C# (CSharp) Method

getPost() private method

private getPost ( string postid, string username, string password ) : CookComputing.XmlRpc.XmlRpcStruct
postid string
username string
password string
return CookComputing.XmlRpc.XmlRpcStruct
        public XmlRpcStruct getPost(string postid, string username, string password)
        {
            Authenticate(username, password);
            CheckUserRights(postid, username);

            var rpcstruct = new XmlRpcStruct();
            var entryItem = GetContentDatabase().GetItem(postid);
            if (entryItem != null)
            {
                var entry = new EntryItem(entryItem);

                rpcstruct.Add("title", entry.Title.Raw);
                rpcstruct.Add("link", entry.AbsoluteUrl);
                rpcstruct.Add("description", entry.Content.Raw);
                rpcstruct.Add("pubDate", entry.EntryDate.DateTime);
                rpcstruct.Add("guid", entry.ID.ToString());
                rpcstruct.Add("author", entry.InnerItem.Statistics.CreatedBy);
            }

            return rpcstruct;
        }

Usage Example

示例#1
0
        public void GetPost_ExistingEntry()
        {
            var entry11 = m_blog1.Axes.GetDescendant("Entry11");
            var content = m_api.getPost(entry11.ID.ToString(), m_userAuthor.Name, PASSWORD);

            Assert.AreEqual(entry11["title"], content["title"]);
            Assert.AreEqual(entry11["content"], content["description"]);
            Assert.AreEqual(entry11.ID.ToString(), content["guid"]);
        }