Quantcast
Channel: DevNet Questions
Viewing all articles
Browse latest Browse all 8836

Attached document from code behind does not show up in CMS Administration

$
0
0
Hi, I am attaching text file to root page from code behind. Also I am able to fetch the file using attachment URL. http://domainname.com/SiteName/getattachment/SiteName.txt.aspxstring jsondata = @somejsondata@; using (StreamWriter _testData = new StreamWriter(Server.MapPath(@~/@ + CurrentSite.SiteName + @.txt@), false)){ _testData.WriteLine(jsondata); // Write the file. } //Attach txt file to root page string filepath = Server.MapPath(@~/@ + CurrentSite.SiteName + @.txt@); try{ DocumentAttachment attachment = DocumentHelper.GetAttachment(rootPage, CurrentSite.SiteName + @.txt@, false); if (attachment != null) { DocumentHelper.DeleteAttachment(rootPage, attachment.AttachmentGUID); rootPage.Update(); } else { DocumentHelper.AddAttachment(rootPage, @FileAttachment@, filepath); rootPage.Update(); } } catch (Exception ex){} This attachment is not visible in CMS administration dashboard. RootPage -@ Properties -@ AttachmentKindly help.Manmath.

Viewing all articles
Browse latest Browse all 8836

Trending Articles