sharepoint-object-model

PreSaveAction is not working in SharePoint office 365 (2016)

痴心易碎 提交于 2019-12-12 04:37:13
问题 I am working on SharePoint office 365 (2016), and facing issue while adding custom validation in new item form. Here scenario is complex, I can't handle by using Validation setting/formula. So I have choose custom JavaScript code. As validation should be perform on click of Save button and PreSaveAction method successfully called but only in 'Classic Experience' but when user changed to 'New Experience' it won't call because of change of HTML structure of the form. Does any one have an idea

How to get all sites and sub-sites in SharePoint and access an image library/list?

穿精又带淫゛_ 提交于 2019-12-11 05:04:08
问题 How to get all sites and sub-sites in SharePoint and access an image library/list? I am looking forward to achieve this via the SharePoint object model. Inside each site or subsite I want to access an image library/list, After getting to this list, how do I set the option of 'Required Content Approval for Selected Items' from 'Yes' to 'No'? 回答1: Use the SPFarm object to get all web applications then use SPWebApplication to get all sitecollection and then use SPSite to get all Webs. You have

How to detect page refresh in .net

好久不见. 提交于 2019-11-30 08:29:51
I have a Button_click event. While refreshing the page the previous Postback event is triggering again. How do I identify the page refresh event to prevent the Postback action? I tried the below code to solve it. Actually, I am adding a visual webpart in a SharePoint page. Adding webpart is a post back event so !postback is always false each time I'm adding the webpart to page, and I'm getting an error at the else loop because the object reference is null . if (!IsPostBack){ ViewState["postids"] = System.Guid.NewGuid().ToString(); Cache["postid"] = ViewState["postids"].ToString(); } else{ if

How to detect page refresh in .net

不问归期 提交于 2019-11-29 12:27:17
问题 I have a Button_click event. While refreshing the page the previous Postback event is triggering again. How do I identify the page refresh event to prevent the Postback action? I tried the below code to solve it. Actually, I am adding a visual webpart in a SharePoint page. Adding webpart is a post back event so !postback is always false each time I'm adding the webpart to page, and I'm getting an error at the else loop because the object reference is null . if (!IsPostBack){ ViewState[