override protected void GetNextRecord()
        {
            WikiArticlesViewItem wiki = WikiArticlesView.GetWikiArticlesViewItem(_loginUser, _itemIDList[_rowIndex]);

            _lastItemID = wiki.ArticleID;
            UpdatedItems.Add((int)_lastItemID);

            DocText = HtmlToText.ConvertHtml(wiki.Body == null ? string.Empty : wiki.Body);

            _docFields.Clear();
            foreach (DataColumn column in wiki.Collection.Table.Columns)
            {
                object value = wiki.Row[column];
                string s     = value == null || value == DBNull.Value ? "" : value.ToString();
                AddDocField(column.ColumnName, s);
            }
            DocFields = _docFields.ToString();

            DocId           = wiki.ArticleID;
            DocIsFile       = false;
            DocName         = wiki.ArticleID.ToString();
            DocDisplayName  = wiki.ArticleName;
            DocCreatedDate  = wiki.CreatedDate;
            DocModifiedDate = DateTime.UtcNow;
        }
        public static string GetWikiArticlesViewItem(RestCommand command, int articleID)
        {
            WikiArticlesViewItem wikiArticlesViewItem = WikiArticlesView.GetWikiArticlesViewItem(command.LoginUser, articleID);

            if (wikiArticlesViewItem.OrganizationID != command.Organization.OrganizationID)
            {
                throw new RestException(HttpStatusCode.Unauthorized);
            }
            return(wikiArticlesViewItem.GetXml("WikiArticlesViewItem", true));
        }
Exemple #3
0
        public static string GetWikiArticle(RestCommand command, int articleID)
        {
            WikiArticlesViewItem wikiArticle = WikiArticlesView.GetWikiArticlesViewItem(command.LoginUser, articleID);

            if (wikiArticle.OrganizationID != command.Organization.OrganizationID)
            {
                throw new RestException(HttpStatusCode.Unauthorized);
            }

            if (wikiArticle.Private == true)
            {
                throw new RestException(HttpStatusCode.Forbidden, "Private wiki articles cannot be retrieved by the API");
            }

            return(wikiArticle.GetXml("Article", true));
        }