Search
 
SCRIPT & CODE EXAMPLE
 

CSHARP

kentico 13 api save attachment

// Gets the first page located under /Articles
TreeNode page = new DocumentQuery<TreeNode>()
                    .Path("/Articles", PathTypeEnum.Children)
                    .OnSite("MySite")
                    .Culture("en-us")
                    .TopN(1)
                    .FirstOrDefault();

if (page != null)
{
    DocumentAttachment attachment = null;

    // Prepares the path of the file
    string file = System.Web.HttpContext.Current.Server.MapPath("/FileFolder/file.png");

    // Inserts the attachment into the 'ArticleTeaserImage' field and updates the page
    attachment = DocumentHelper.AddAttachment(page, "ArticleTeaserImage", file);
    page.Update();
}
Comment

PREVIOUS NEXT
Code Example
Csharp :: CharacterController 
Csharp :: gersener waves 
Csharp :: how to specify order of test in c# 
Csharp :: List picking records from database 
Csharp :: random.choice c# 
Csharp :: how to move the camera rotation in phone in c# by touch 
Csharp :: c# Windows Forms screenshot 
Csharp :: binary addition c# 
Csharp :: unity int inputfield value 
Csharp :: c# summary angle brackets 
Csharp :: unity custom editor draw line in scene 
Csharp :: PUN 2 Network Transform View Jittery Movement 
Csharp :: unity slider decimal 0.01 
Csharp :: JAJAAJAJAJ 
Csharp :: reflection assemblies gettypes 
Csharp :: ef core totable 
Csharp :: linq dynamic order by descending 
Csharp :: auto refresh gridview c# 
Csharp :: Unity make a homing object 
Csharp :: cqrs design pattern .net core 
Csharp :: how to mock abstract httpcontext using moq .net core 
Csharp :: player leaning unity 
Csharp :: scale curve revit api 
Csharp :: AutoFixture ignore property 
Csharp :: c# .net calculate md5 
Csharp :: c# check number is odd or even 
Csharp :: c# copy each property 
Csharp :: c# operators 
Csharp :: c# enum to string 
Csharp :: unity c# request store review 
ADD CONTENT
Topic
Content
Source link
Name
2+3 =