Skip to main content

Posts

Showing posts with the label Client Object Model

Update all Pages to entire Sites and SubSite using Client Object Model C#

If you want to update, Delete any and all the list, document library, publishing library to entire site collection. Following code will be helpful to achieve this requirements. public static class Program { static void Main(string[] args) { try { using (ClientContext _context = GetSiteContext(Constants.DeploymentSiteUrl)) { var webs = clientContext.Site.EnumAllWebs(w => w.Title, w => w.Lists); foreach (var web in webs) { foreach (var list in web.Lists) { if (list.Title == "Pages") { Console.WriteLine(web.Title + "-----" + list.Title); result.Add(web.Title + list.Title); CamlQuery query = CamlQuery.CreateAllItemsQuery(); query.ViewXml = @" "; ListItemCollection...

Using the SharePoint 2010 Modal Dialog

SharePoint 2010 introduces the new dialog framework which helps users stay in context of the page without navigating away from the page. Yes, the modal dialogs that pop up: The JavaScript client object model provides the  SP.UI.ModalDialog  class to work with the dialog framework. In order to work with the dialog framework, we need to first create the dialog options: var options = SP.UI.$create_DialogOptions(); options.width = 500; options.height = 250; options.url = "/_layouts/StandardsPortal/ChangePassword.aspx" ; options.dialogReturnValueCallback = Function.createDelegate( null , portal_modalDialogClosedCallback); As you can see from the above code, we set options on width, height and what is the URL the modal dialog should load. In this case, an Application Page. Notice that we also initialize the callback. Once the options are set, you can now show the modal dialog: SP.UI.ModalDialog.showModalDialog(options); Now warp this code into a funct...