Kentico 9 - separate MVC App - Create Document Attachments

Scott Beveridge asked on February 25, 2016 04:33

I am trying to add an attachment to a document - I am running a separate MVC application - not part of the same solution as the Kentico admin site.

I am getting error site not found for my userinfo.

public Models.PartnerUpdateModel NewPartnerUpdate(Models.PartnerUpdateModel partnerupdatemodel) { CMS.DocumentEngine.TreeNode newpartnerupdatetreenode = CMS.DocumentEngine.TreeNode.New(partnerupdatemodel.KenticoPartnerUpdate.ClassName); TreeProvider tree = new TreeProvider(); partnerupdatemodel.KenticoPartnerUpdate.Title = partnerupdatemodel.Title; partnerupdatemodel.KenticoPartnerUpdate.Summary = partnerupdatemodel.Summary; partnerupdatemodel.KenticoPartnerUpdate.Article = partnerupdatemodel.Article; partnerupdatemodel.KenticoPartnerUpdate.Author = partnerupdatemodel.MarketConnectUser.UserID.ToString(); partnerupdatemodel.KenticoPartnerUpdate.DocumentCulture = partnerupdatemodel.DocumentCulture; partnerupdatemodel.KenticoPartnerUpdate.Insert(TreeHelper.SelectSingleNode(partnerupdatemodel.MarketConnectUser.DefaultGroup.GroupChildNodes.Where(x => x.Key == partnerupdatemodel.ParentClassName).Select(x => x.Value).Single()), true); partnerupdatemodel.KenticoPartnerUpdate.SubmitChanges(true); foreach (var file in partnerupdatemodel.Files) { HttpPostedFile postedfile = FileHelper.ConstructHttpPostedFile(FileHelper.ToByteArray(file.InputStream), file.FileName, file.ContentType);
DocumentHelper.AddAttachment(newpartnerupdatetreenode, Models.PartnerUpdateModel.AttachmentColumnNames.Image.ToString(), postedfile, new TreeProvider(MembershipContext.AuthenticatedUser));//GET ERROR HERE

            newpartnerupdatetreenode.Update();
        }
        return partnerupdatemodel;
    }

asp.net-mvc kentico

   Please, sign in to be able to submit a new answer.