Add custom event on JS Grid in Project Server

I have been working on project server customization and development since more than four years, and have helped clients with specific custom solutions to suit their business requirement. These customizations include site customization, custom web part creation and workflows. Recently I came across a requirement to attach an event on JS Grid of Project Server out of box Details Web Part on Project Server 2013. Here I share the solution we implemented for this requirement. The JS Grid control helps display and manipulate tabular data in Web Parts for Microsoft Project Server 2010/2013. Project Server Out of box web parts like My Task, Project Center and Details use JSGrid. 1.       Get the JS Grid control instance Component object of ‘Details’ web part of Project Server is ‘projectDrilldownComponent’. If we add ‘Details’ web part on Project Detail Page (PDP), then projectDrilldownComponent object will be available. Using ‘projectDrilldownCompsonent’, get the JS Grid Control Instance Code:  _grid = projectDrilldownComponent.get_GridSatellite().GetJsGridControlInstance(); 2.       Attach event on JS Grid The JS Grid control offers the following client-side events. Link has details for the list of event on JSGrid. AttachEvent () function of JSGrid can be used to attach event on JS Grid. Argument for this function is the type of event to be attached and the function to be called on this event. In below sample code, we are attaching the OnRowFocusChanged event on JS Grid and getting the selected record. _grid.AttachEvent(SP.JsGrid.EventType.OnRowFocusChanged, function (eventArgs) { TaskChangeEvent(eventArgs) Below is the complete sample code. Create a text file with the below code and upload the file on any document library, and create a PDP page. Add the Details out of box web part from Project Web App category on the page. Also, add the content editor web part and give the reference of text file that we have uploaded in the document library.

How to filter specific project report on project site

In an organization, there are multiple projects and for each project there are multiple reports generated. For effective tracking and monitoring, various out of the box reports are available in the Project Server. Quite often it happens that project managers and team members demand for report view that corresponds only to their projects and not the entire organization. To meet this requirement, here is a solution that can filter out specific project data from the excel report, so that the user does not have to go through the complete list of projects to find data related to his project on the Project Site. Below is the excel report showing the count of completed tasks for all projects. Now to filter out the specific list, below are the steps to be followed: Add Slicer to the excel report. Add a web part to add the excel report. Add Content Editor web part to refer to the JavaScript file that will filter out specific project in the excel reports. Note: Pre-Requisite: SQL Server analysis services in Power Pivot mode must be installed.  Detailed steps: Add Slicer to the Excel Report : Open the excel report in edit mode in excel from the SharePoint document libraryBusiness Intelligence. Select the Pivot Table. Under the ANALYSE tab, select Insert Slicer. On the Slicer window, select the project name (which will be used for filtering). Add Slicer as a parameter: Select Info of the excel -> select Browser View Options->a pop up window will appear -> Select Parameter tab -> Add the desired slicer so that it can be used as filter parameter in the web browser. Save and upload the excel report. Add a web part to add the excel report.   Navigate to the project site page where we need to add the excel reports (For example – Project Q 003). Open the page in edit mode . Click on Add a Web Part A selection window will open. From the Business Data category select Excel Web Access web part and click Add. The web part will be added. Click on link Click here to open the tool pane to edit the web part and set properties We need to fill out the workbook field with the URL of the workbook. Browse to the location of the excel report and add it. Add Content Editor web part to refer to the JavaScript file that will filter out specific project in the excel reports. Upload the JQuery file named “jquery-1.11.2.min.js” into a SharePoint shared document library present on the root site. Upload the Java script file named “QueryFilterData.txt” into a SharePoint shared document library present on the root site. Before uploading the custom  QueryFilterData.txt file, we need to update the Project Server URL. In this case – “http://tfspsdemo2013/PWA” is our development machine URL. Now add the content editor web part to refer to the JavaScript file. Click on Add a Web Part. A selection window will open. From Media and Content category, select Content Editor web part and add it. Edit the web part and enter the path of the JavaScript file (Name: QueryFilterData) added in Step 2 and click on Test Link. If the file opens in another tab then the link is correct. Click Apply and then click OK. Once all the steps are done, click Stop Editing and there you go! You will see the report data showing only filtered specific project data. You may also want to refer to the below Java script: Java Script Code:   To find the project name: function getProjectNameCallback() { projectUID = spWebProps.get_fieldValues()[“MSPWAPROJUID”]; projContext = PS.ProjectContext.get_current(); projects = projContext.get_projects(); projContext.load(projects, ‘Include(Name, Id)’); projContext.executeQueryAsync( iterateThroughProjects, errorCallbac); } function iterateThroughProjects(response) { var enumerator = projects.getEnumerator(); while (enumerator.moveNext()) { var project = enumerator.get_current(); var id = project.get_id(); if (id == projectUID) { projectdetail = project.get_name(); if (typeof(projectdetail) != undefined) { // alert(projectdetail); PageLoad();   } break; }   }  }; Set Project Name to the Slicer: Each EwaControl is associated with only one workbook. The EwaControl.getActiveWorkbook method returns the workbook associated with the specified EwaControl object. ewaInstance =Ewa.EwaControl.getInstances().getItem(index); (In Case there is single excel report then use Index as 0, in case of multi excel report we need to iterate through it). var objCollection = {}; (Array) objCollection[‘Slicer_ProjectName’] = [projectdetail];  (Slicer_ProjectName is the Excel Slicer Name) ewaInstance.getActiveWorkbook().setParametersAsync(objCollection, SetParamsAsyncCallback, null); (This will set the Slicer parameter on the report).  

How to choose a PHP framework

With the increasing popularity among web frameworks, it can get a bit difficult to decide which framework will be best suitable for your projects. While some take their decision on the basis of performance, others may look for a substantial built-in functionality or a well-documented framework. Here in this blog we will take a look on what features and factors should be considered before choosing any framework for the project. A PHP framework provides us with reusable code and a foundation to build web apps. It also helps in improving productivity and creating more stable sites. Most of the popular frameworks are based around MVC (model-view-controller), ensuring the separation of logic and presentation which in turn helps us to write clean and reusable code. Before deciding on a framework for your application, you should understand the needs and requirements of your application. Here are a few questions you should consider before deciding on a particular framework: 1.      What is the main goal of your application? Will you be developing an ecommerce portal, a social platform, a blog or a business website? An ecommerce portal will require a framework with the facility for payment integration, while a blog site may need a framework with options for various themes and plugins to choose from. 2.      Is good documentation available? Finding difficulty in understanding someone else’s code is every developer’s story. Picking a framework with a good documentation will make it easier for the programmers to understand the source-code and develop applications. 3.      Does the framework have an active user base and development support? If the framework you are working on ends up feebly with no active development support, you can either continue using the framework and maintain it yourself or re-code your application to use a new framework. In order to make sure you don’t get stuck with a framework on a dead-end, take time to research the community of a framework while the project is still in the planning phase. The Frameworks Let’s discuss some of the popular PHP frameworks:   CakePHP It is the most popular and one of the oldest framework. The idea behind CakePHP was to make developing applications fast by implementing “convention over configuration”. With the features like fast coding, better security and Ajax support, CakePHP helps in creating robust business websites which are completely customizable and in accordance with the W3C standards. Like last year when we started working on Neohapsis website, CakePHP was the mutual choice as client wanted a hacker safe website and this framework comes with built-in tools which covers security to a certain level. For example, it takes care of SQL injection, data validation, form spoofing and CSRF. Another website that we developed for Nucleus Software is a CMS based easy to update website. Using conventions from the framework we created admin backend, whole foundation of which is based on basic CRUD functionality.    CodeIgniter CodeIgniter is a lightweight framework that provides simple platform to develop full-featured web applications. This is a perfect fit for developing any application from small scale informative website to an e-commerce solution. Having worked on multiple MVC platforms, I have learnt that when the key area of concern is scalability and ease of programming, CodeIgniter is the most suitable option. With loads of libraries, plug-ins and helpers available, it takes care of complex programming, all the while maintaining the performance. Here are a few benefits that I like with CodeIgniter: It’s easy to configure and customize as per the requirements It’s built with a simple to understand folder structure It makes programming quick and developer-friendly Easy integration with third-party libraries Easy to learn documentation and tutorials   Laravel Laravel still in its early days has recently gained popularity among PHP developers. The main reason behind is built-in features like “flexible routing”, “easy database interaction”, “plugins”. This framework is suitable for various sectors like RESTful application, small business app or big enterprise solution. Laravel offers a number of features which makes it so popular: Eloquent ORM: It offers a very powerful active-record implementation, which makes it easy to perform any database query. Flexible Routing: A simple routing mechanism, which is very helpful for developing your own APIs. Form Model Binding: In a scenario where we want to edit/update any records in a database, we can use form model binding to populate the form with respective values from database table. Authentication: Laravel offers a built-in authentication library which is simple to implement. To perform a login operation, we just need to pass an array of credentials, while for logout this one liner works (Auth::logout();). View Existing Routes: With the continuous expansion of application, it gets difficult to check what routes have been registered. Laravel offers a simple command (php artisan routes) to list down all the registered routes in application. Commands: You can write your custom commands to perform tasks like fetch data from a third-party API, backup script for application, etc. You can run it as CLI or use them for CRON jobs. Form Validation Rules: Laravel offers various rules that can be used to add validation on any object. There are few other frameworks that you may consider.   Zend Framework Based on the object oriented approach, Zend Framework is most suitable for experienced developers and for building enterprise-level and business critical applications with following features: Active user base and large community Modular architecture Video tutorials   Symphony This framework follows Ruby-On-Rails like programming methods. With factors like Ajax helpers, internationalization, admin-interface generator this framework makes it easy to develop web applications. Some of the useful features that Symphony offers are: ·         One-click admin interface ·         Built-in testing framework ·         Easy debugging ·         Logs to track app’s activities  Here’s a chart from Google Trends comparing popularity of different frameworks for last 12 months:    At the end, choose a framework you are comfortable working with. With all the details mentioned above, you can now figure out which framework meets the requirements for your project. Hope this

How to authenticate Android, iOS apps to access Project 2013

Accessing OData endpoint of the Project Online 2013/Project Server 2013 in any custom mobile app requires some authentication mechanism. For accessing Project Online/Project Server 2013, you need to implement one of the below described authentication modes/method and also enable special permissions for the user who accesses OData endpoints via apps. Authentication Providers There are a variety of Security Support Provider Interfaces (SSPI) by Microsoft that are available for the authentication purpose. SharePoint users are most familiar with – Microsoft NTLM and Microsoft Kerberos. NTLM and Kerberos are the types of Windows Claims-based Authentication using Active Directory Services (AD DS) as the authentication store and user credentials validation. Kerberos as a security support provider has been a part of Windows since Windows Server 2000 and was proposed as a replacement for NTLM. The two often work together or in a mixture across Windows environments. Authentication methods for Android and iOS Project Online 2013 and Project Server 2013 support multiple authentication methods and authentication modes. When you plan for mobile app access, you must consider the available authentication methods for the mobile OS. 1.Claims-based authentication with mobile apps 2.NTLM authentication with mobile apps 1. Claim based authentication with mobile apps What is Claim? A claim is a simple piece of information that describes a given identity on some aspect. A claim can be held in the authentication token like an envelope that may contain other identifying information and a signature that can be used to verify that the token is not tampered on its way from remote machine to your system. Claim based authentication Claims-based authentication is now a more general way of authentication, which allows users to authenticate on an external system. It is the process of establishing users’ identity and ensuring that the information is not tampered. Courtesy TechNet library Flow for Claim based authentication with app 1.Request to Project Online 2013 via web view 2.System redirects user to the authentication page of Office 365 3.After successful authentication to Office 365, it will return cookie and tokens 4.App validates the cookie and tokens 5.Once the token and the cookie is received, the app is able to access ODATA 2. NTLM authentication with mobile apps What is NTLM authentication It is the windows challenge/response (NT-LAN manager) authentication protocol used on networks that include systems running the Windows operating system and on stand-alone systems. In terms of the mobile app, an Interactive NTLM authentication over a network typically involves two systems: a mobile app, where the user is requesting authentication, and a domain controller, where information related to the user’s password is kept. Un-interactive authentication, which may be required to permit an already logged-on user to access a resource such as a server application, typically involves three systems: a mobile app, a server, and a domain controller that does the authentication calculations on behalf of the server. Flow for NTLM Authentication with app 1.A user accesses a mobile app and provides a domain name, user name, and password. The mobile app computes a cryptographic hash of the password and discards the actual password. 2.The app sends the user name to the server (in plaintext). 3.The server generates a 16-byte random number, called a challenge and sends it to the mobile app. 4.The app encrypts this challenge with the hash of the user’s password and returns the result to the server. This is called the response. 5.The server sends the following three items to the domain controller:            1.User name            2.Challenge sent to the app            3.Response received from app 6.The domain controller uses the user name to get the hash of the password from the Security Account Manager database. This password hash is used to encrypt the challenge. 7.It then compares the encrypted challenge computed in step 6 to the response computed in step 4. If they are identical, authentication is successful. Working with Project Online 2013 Accessing Project Online 2013 via mobile apps require some more efforts. You need to develop the header to access project server online otherwise it will return an unauthorized access error. To create a valid header, first you need to verify two cookies FedAuth and rtFa. If they exist, then create a new header named Cookie and add to your request, then after the GET request can be made to the server. 1.Write a code to read data from server 2.Set HTTP method as ‘GET’ 3.Add another header Cookie and add both cookies ‘FedAuth’ and ‘rtFa’, which are required to access Project online Working with Project Server 2013 To access Project Server 2013, app required to implement NTLM authentication. For iOS, there is already a library which provides NTLM authentication, for android either you can write a code manually or can use third party libraries like https://github.com/masconsult/android-ntlm Accessing Project server OData endpoints with mobile apps Now that you have finished with the complicated part, all you need to do is, write a code to access web service end points (OData endpoints). OData API URL To access OData, you also need the URL of Project Online 2013 or Project Server 2013 OData API. In most of the cases it will be: / _api/projectdata/ Try this URL with your browser to list the end points. Then use endpoints according your need. Permissions required To access OData services, you need to enable reporting permissions which can be found in global permissions. Using $filter, $select and other oData query oData queries can be used with a mobile app by ensuring that the URL you develop for query contains valid characters. Conclusion Using the above described method, a user can authenticate mobile apps (Android or iOS) to access Project Online 2013 or Project Server 2013. Users can also call GET web requests in the app to access Project Online 2013 or Project Server 2013 data like current project, resources, timesheet, tasks and assignment information. For additional HTTP verbs like PUT and POST, one needs to add some

How to generate PDF in ASP.NET MVC

Generating PDF, reports or any document in MVC is generally the basic requirement in most of the projects. To address this requirement, we can leverage a third party tool “Rotativa” to generate PDF documents. Rotativa is an asp.net library which helps in spawning PDFs from MVC controller. This tool gives us the flexibility to create PDFs directly from views, partial views or URL. We need to follow certain steps to generate PDF from Rotativa tool: Open Visual Studio. Select File -> New Project. Select ASP.NET MVC 4 Web Application under Templates-> Visual C#->Web->Visual Studio 2012. 4. Select Empty or Internet Application template, and select Razor as the view engine. 5. Add a class in Models folder with SampleModel name. 6.  Add a Controller in Controllers folder with SampleController name. 7. Add a strongly typed view to create a view aligned with a particular class or a dynamic     view for creating a generalized view. 8. To leverage the Rotativa tool in our application to generate PDF, we need to install Rotativa using Manage nuget packages. 9. Right click on References folder in Solution and click on Manage Nuget Packages. Search online and add Rotativa as shown below: 10. Add this line of code in SampleController class. using System; using System.Collections.Generic; using System.Linq; using System.Web; using System.Web.Mvc; using RotativaSample.Models;   namespace RotativaSample.Controllers {     public class SampleController : Controller{         public ActionResult Index(){                            return View();         }         public ActionResult GetSamples()         {   SampleModel obj=new SampleModel();             List sampleList = new List();             sampleList = obj.GetSampleDetails();             return View(sampleList);                }         public ActionResult GeneratePDF()         {   SampleModel obj = new SampleModel();             List sampleList = new List<samplemodel< span=””></samplemodel<>>();             sampleList = obj.GetSampleDetails();             return new Rotativa.ViewAsPdf(sampleList)                 {                     PageSize = Rotativa.Options.Size.A4,                     PageOrientation = Rotativa.Options.Orientation.Landscape,                     PageMargins = new Margins(12, 12, 12, 12),// it’s in millimeters                     PageWidth = 180,                     PageHeight = 297,                     CustomSwitches = “–outline –print-media-type –footer-center ”Confidential”  –footer-right  [page]/[toPage]  –footer-left  [date]“                    }; }  }  } How to add header and footer in Rotativa PDF To add header and footer in Rotativa pdf, we need to add “CustomSwitches” as mentioned in the above code.      Sample.cs: Model Class using System; using System.Collections.Generic; using System.Linq; using System.Web; using System.Web.Mvc; namespace RotativaSample.Models {   public class Sample     {   public int EmpId {get;set;}         public string Name { get;set;}        public string Email {get;set;}         public string Country { get;set;}          } public List GetSampleDetails()  {             List samples = new List();            samples.Add(new SampleModel() { EmpId = 491, Name = “abc”, Email = “abc@gmailcom”, Country         = “India” });             samples.Add(new SampleModel() { EmpId = 492, Name = “xyz”, Email = “xyz@gmail.com”, Countr    y = “India” });             return (samples);         } }} Add another view in Views folder with “GetSamples.cshtml” name and add the below code:    @model dynamic @{     Layout = null; } GetSamples         @foreach (var item in Model)     {           }            Employee Id                     Employee Name                     @item.EmpI             @item.Name             1.       To leverage the Rotativa tool in our application to generate PDF, we need to install Rotativa using “Manage nuget packages”. 2.  Right click on References folder in Solution and click on Manage Nuget Packages. Search online and add Rotativa as shown below: How to add CSS in Rotativa PDF When we are using SSRS reports we are pampered with automatic features, such as paging, headers, footers, numbering. HTML to PDF converter lacks this feature, so if you need to add CSS, you need to use inline CSS. You need to add CSS to your html page in style section E.g.: Add a page break               Then add this line of code before the starting of any page:  Conclusion Many LOB applications require printable documents in PDF format such as invoices, receipts, etc. Generating such types of printable documents in Asp.Net MVC application is a little bit complex. By leveraging the Rotativa tool in MVC application we can easily generate the printable PDF docs with custom header and footer. You can follow the above process to generate PDF in asp.net MVCwith Rotativa. Rotativa tool is very easy to use and gives full control over header and footer elements such as adding page number, date, etc. NEED HELP IN ASP.NET MVC? CONTACT US NOW Alpa Sarupria Software Developer Advaiya Solutions Inc Udaipur, Rajasthan, India

How to implement QuickProject in your organization

Microsoft Project Server 2013 is a flexible on premise solution for Project Managers, PMOs & team members in project planning, project tracking and managing portfolio; but it is only accessible via a PC or a laptop. Staying connected with the project is an all-time need for project team. Considering this challenge, Advaiya has developed QuickProject project management app that provides a mobile interface to help project managers and team stay connected with Microsoft Project Server 2013. It has an easy and user-friendly interface which helps to track and update assignments anywhere and anytime. We have talked a lot about the key functionalities of the project management app in these blogs: How is project management on the go with QuickProject QuickProject app for Project Server 2013 Update timesheets on the go with QuickProject       Let’s discuss on how you can implement this app.   To get started with this app for your organization, as administrator, you need to ensure: – You provide acces rights to Project Server 2013 onpremise or online (whichever you have) to the users for whom you want to configure the app – You also need to ensure that you enable the  & Status Broker Permission for these users. To enable ‘Access Project Server Reporting Service’ permission, follow these steps: – 1. Click on PWA/server settings 2. Select ‘Manage Groups’ under security section 3. Select group name 4. In Global Permissions, Under General section, check the check box for Access Project Server Reporting service. To enable ‘Status Broker Permission’, follow these steps – 1. Click on PWA/server settings 2. Select ‘Manage Groups’ under security section 3. Select group name 4. In Global Permissions, Under Time & Task Management section, check the check box for Status Broker Permission. The app works for both Project server 2013 (on-premise) as well as online accounts. If the app is configured with ‘Project server online’ PWA URL, the user will not be able to update assignment(s) and access timesheet to save and submit. If the app is configured with Project Server 2013 (on-premise), user can update assignments and also save and submit the timesheet.   The quick link of QuickProject app on iTunes is available here. Some minutes spent on this app, will definitely let the user understand its ease of use and benefits. So, what are you waiting for, enable the quick configuration for your organization and get the Project access on your mobile  

Save multiple tags and links with descriptions in SharePoint

In SharePoint you can save and get the information from list easily using AJAX call, CSOM and JavaScript. While saving multiple tags to the column of type ‘managed metadata’ with hyperlinks and descriptions for each metadata, common problems faced are– If tags are saved first, then rest of the items vanish If other information is saved first, then ‘tags’ column is left blank Many a times URLs with their descriptions get disorganized Solution to the above problems is provided below to save multiple tags and URL with description successfully. Remember that for saving tags, their GUID value is essential. Here ‘oListItem.update’ is executed for all the items to be saved and at last ‘executequeryasync’ for finally saving it to the SharePoint list after the loop. Steps to follow – Setup context and load web Load taxonomies field Save URL and description Save tags having their GUID value and NAME value Update every time oListItem till the length of the item At last, execute clientContext.executeQueryAsync after all the items are loaded This will save all the information without leaving any of the details blank. Below is the code for the implementation of the same. ‘ListName’ is the name of the list in which the data is to be saved. Setup context & load web var clientContext = new SP.ClientContext.get_current(); var oList = clientContext.get_web().get_lists().getByTitle(ListName); Load properties of tag field var field = oList.get_fields().getByInternalNameOrTitle(TagColumnName); var txField = clientContext.castTo(field, SP.Taxonomy.TaxonomyField); clientContext.load(txField); clientContext.executeQueryAsync(function() { var urlLink = ”, description = ”; Loop to save multiple hyperlinks with description for (var j = 0; j < resourceURL.length; j++) { urlLink = resourceURL[j][0]; description = resourceURL[j][1]; var itemCreateInfo = new SP.ListItemCreationInformation(); var oListItem = oList.addItem(itemCreateInfo); var urlValue = new SP.FieldUrlValue(); urlValue.set_url(urlLink); urlValue.set_description(description); This code is to save multiple tags to metadata column. For saving tags, their GUID and NAME value is essential. if (txField.get_allowMultipleValues()) { var terms = new Array(),termValueString ,guid = [],name = []; guid = selectedguid.split(“,”); name = selectedValue.split(“,”); for (var i = 0; i < guid.length; i++) { terms.push(“-1;#” + name[i] + “|” + guid[i]); termValueString = terms.join(“;#”); } var termValues = new SP.Taxonomy.TaxonomyFieldValueCollection(clientContext, termValueString, txField); txField.setFieldValueByValueCollection(oListItem, termValues); }              oListItem.set_item(‘Link’, urlValue); Update Listitem oListItem.update(); clientContext.load(oListItem); } clientContext.executeQueryAsync(function(){ alert(“Success”);}, OnFailure); }, onFailure ); Points to remember while saving multiple taxonomies with multiple URLs and description: First load properties of tag field and upon success, save tags having their GUID value Execute client context only after all the items are updated in the loop

Auto-organize and route emails in SharePoint with IESS

Automatically organize and route email documents in SharePoint with IESS

Business documents often originate in the form of email attachments from different sources and need to be stored quickly and accurately at dedicated destinations, to enable easy processing, searching and collaboration. Functions such as finance receive statements, proposals, reports and other documents in multiple email accounts every day. Organizing and routing these email messages involve a multi-step process to filter and classify emails and documents sent and received. SharePoint is known to be the best in class records and collaboration management solution. It organizes information and makes it easily accessible and shareable. Organizations are increasingly adopting SharePoint technology on premise or in the cloud. Recognizing the need for a unified solution combining the functionalities of email and SharePoint, Advaiya brings Intelligent Email Sorter for SharePoint (IESS), an intelligent solution to email sorting challenges faced by organizations in the processing of content received in the multitude of emails each day. Let us consider a scenario where the head office of a large conglomerate receives many financial proposals, operational reports, and other types of documents. These are received in various email accounts of executives across the team, and thus leading to a situation that these documents are placed at a plethora of locations, organized in different ways, making them difficult to find and process. With ‘IESS –Intelligent email sorter for SharePoint’ email sorter app, the rules for classification and extraction can be set, and rest will be taken care of by it. The app will then automatically sort and filter out important information based on the defined rules and process them in the appropriate SharePoint library with relevant metadata such as – ‘unit name’, ‘revenue till month ’, forecasted revenue‘ and so on. These metadata further trigger the relevant dashboard and report. All the manual efforts involved in monitoring the email account to extract, filter information, attachment categorization, dashboard creation, etc., can be automated with IESS, in turn increasing employee productivity and overall business efficiency. For more information on the email sorter app, you can visit – Intelligent email sorter for SharePoint (IESS)

Implementation of SharePoint site column ordering

Implementation of SharePoint site column ordering

SharePoint has column ordering feature to set position of columns in list. Using that we can position columns as required – first, second, and so on. This feature can be implemented programmatically as done below. There can be many ways to implement this, but the one described here is the most efficient and convenient and can be used for many purposes like page ordering, product arrangement in store, etc. General steps to follow- 1. Dynamically create dropdown having positions as options 2. ‘Focus’ event triggered will save the previous position of item 3. Choose from dropdown the new value to set 4. ‘On Change’ event will be fired and will get new position (this.value) 5. First loop will match the new value in the list and set it to previous one 6. Second loop will update the whole list in dropdown with new positions Consider an example – If you need to change the order of pages for particular chapter or book. In a particular book, there are many chapters, and every chapter have various subpages. Now if you need to change their position, from the dropdown having order of all the pages in that chapter, simply select the order where you want to keep the page. At the same time other page will be set to its position same as we do ‘column ordering’ in SharePoint list. Similarly, for particular chapter and selected parent page there are many subpages, so you can adjust position of subpages from the corresponding order dropdown. This will help to arrange pages within a particular chapter and main page easily as swapping is done here. For example – if we set page at second position to first position, then page at position one will automatically be set to second position. Below is the code where dropdowns are created dynamically and on the change of one page order, its value is swapped with other page pageorder. Focus event will get current value of page order and onchange event will change and swap values Main implementation here is swapping done on the change of position same as SharePoint column ordering and two events triggered every time you change value – ‘focus’ event to get previous value before change and ‘onchange’ event to get new value and perform swapping.