Tag Info

Hot answers tagged


You need to load webpart properties before you can read them. That is, var properties = webPart.get_properties(); currentCtx.load(properties); Then read the properties in success method. currentCtx.executeQueryAsync(...


To access SP.WebParts.WebPart Properties it need to be requested explicitly. In your example you could change the expression at the line: currentCtx.load(webPartDefs, 'Include(WebPart)'); with currentCtx.load(webPartDefs, 'Include(WebPart.Properties)'); Modified example var currentCtx = SP.ClientContext.get_current(); var pageFile = ...


Could you not use the built in sharepoint utility: SPUtility.SendEmail(SPContext.Current.Web, false, false, "ss@test.com", "subject", "body"); SPUtility.SendEmail Method


Based on the comment, Exception arises when folder does not exit. So solution is following if (!System.IO.Directory.Exists(folderpath)) { SPSecurity.RunWithElevatedPrivileges(delegate() { System.IO.Directory.CreateDirectory(folderpath); } Needs to check the folder if it exists before writing ...


In case this works on your DEV machine, but not in other environments, ensure the folder exists on all WFE servers of the farm (if there are many), as the code may be executed on any of them.

Only top voted, non community-wiki answers of a minimum length are eligible