コード例 #1
0
        /// <summary>
        /// Updates the post.
        /// </summary>
        /// <param name="serviceUrl">The service URL of the blog.</param>
        /// <param name="username">The blog username.</param>
        /// <param name="password">The blog password.</param>
        /// <param name="postItem">The post object.</param>
        /// <returns>True/False indicating if post was updated.</returns>
        /// <remarks>
        /// It is assumed that the Post object already has the updated
        /// details in it.
        /// </remarks>
        public bool UpdatePost(string serviceUrl, string username, string password,
                               Post postItem)
        {
            object results;

            IMetaWeblog          proxy = (IMetaWeblog)XmlRpcProxyGen.Create(typeof(IMetaWeblog));
            XmlRpcClientProtocol cp    = (XmlRpcClientProtocol)proxy;

            cp.Url = serviceUrl;

            try
            {
                results = proxy.editPost(postItem.postid.ToString(), username, password,
                                         postItem, true);
            }
            catch (XmlRpcFaultException fex)
            {
                throw fex;
            }
            catch (Exception ex)
            {
                throw ex;
            }

            return((bool)results);
        }