Monday, September 25, 2017

Tabbed Navigation in Sharepoint Custom List forms using JQuery

Below are the steps:

1.       Download Jquery from Jquery.com
2.       Add this to Sharepoint All files Folder or Site Assets.
3.     Create new Custom Form (Newform.aspx)
5.       Add the Following Tab code in your Custom form
<div id="tabs">
    <ul>
        <li><a href="#tabs-1">Tab1</a></li>
        <li><a href="#tabs-2">Tab2</a></li>
       
              </ul>
    <div id="tabs-1">
                   <table border="0" cellspacing="0" width="100%">

                   </table>
              </div>
    <div id="tabs-2">
                   <table border="0" cellspacing="0" width="100%">

                   </table>
              </div>
  
</div>

6.       Cut the Column <Tr> from you list and paste under tabs table.

7.       Save this form and preview in browser
8.       Edit this page after clicking page tab
9.       And add two HTML form web parts on that page
10.       Edit first html web part properties and click source editor button, it will open a window copy and paste the jquery and CSS reference in this window.

In my case I have added this jquery folder to Site Assets.

<link type="text/css" href="SiteUrl/SiteAssets/jquery-ui-1.8.18.custom/css/redmond/jquery-ui-1.8.18.custom.css" rel="stylesheet" />    
<script type="text/javascript" src=" SiteUrl /SiteAssets/jquery-ui-1.8.18.custom/js/jquery-1.7.1.min.js"></script>
<script type="text/javascript" src=" SiteUrl /SiteAssets/jquery-ui-1.8.18.custom/js/jquery-ui-1.8.18.custom.min.js"></script>
<script type="text/javascript">
            $(function(){
                // Tabs
                $('#tabs').tabs();   
            });
</script>
11.       Save the page and Stop editing your Tabs are ready.


Tuesday, August 1, 2017

Export SharePoint Group Users Into Excel 2013 Using OData And REST API

Prerequisites:
  1. SharePoint 2013 On-prem or O365 site, where you have sufficient permissions to perform REST query.
  2. MS Excel 2013, where you already signed-in with your domain account (for On-prem) or O365 account.


Steps to export data from SharePoint to Excel
  1. Open Excel 2013.
  2. Go to ribbon, select DATA and select From Other Sources, and click on From OData Data Feed.
  3. In ‘Data Connection Wizard’ form, provide appropriate REST link (see table above) and click on Next.

    REST Link format to get SPGroup users:

    https://<Your SP2013 Site>/_api/Web/SiteGroups/getbyname('<Group Name')/Users
  4. In Next form, select ‘Users’ table and click Next.
  5. In next form provide an appropriate data connection file name & friendly name (Note: this is not excel file name), check ‘Always attempt to use this file to refresh data’ and click Finish.
  6. In last form, ensure that ‘Table’ is selected. Select worksheet (by default its existing worksheet which is open) and click OK.
  7. Users of that group will be exported to the excel sheet.
Note: We can use same steps to get data from SharePoint lists into Excel with OData Data feed and REST API by providing a valid REST query in step #3.

Monday, July 3, 2017

How to get Item type/entity using REST JQUERY


Friday, June 30, 2017

Box Shadow on table row not appearing on certain browsers

The box-shadow property works only with elements that have display: blockor display:inline-block property.

Tuesday, June 13, 2017

FILTERING LISTVIEWS WITH URL QUERY STRING

  • Basic URL filters - AllItems.aspx?FilterFields1=ColumnName&FilterValues1=ValueText
  • Filtering multiple columns - AllItems.aspx?FilterFields1=ColumnName&FilterValues1=ValueText&FilterFields2=ColumnName&FilterValues2=ValueText
  • Multiple filter values on a single column -&FilterName=______&FilterMultiValue=____;____;_____
  • Wildcard filters - &FilterName=Product&FilterMultiValue=*jet* // for all values that contains "jet".
  • Filtering on lookup columnsAllItems.aspx?FilterFields1=Product&FilterValues1=4 // where Product is a Lookup Column and '4' is the Lookup Id of the text you want to filter.

FYI - (Interner Source) - http://sharepointificate.blogspot.de/2012/12/filtering-listviews-with-url-query.html

Monday, June 12, 2017

Get folders and files of SharePoint library using REST JSOM

<script type="text/javascript" src="../../SiteAssets/Scripts/jquery.2.1.3.min.js"></script>

<html>
<body>
<ul id="root_hierarchy"></ul>
</body>
</html>

<script type="text/javascript">
ExecuteOrDelayUntilScriptLoaded(showHierarchy,"sp.js");

function showHierarchy(){
    $.ajax({
url: _spPageContextInfo.webServerRelativeUrl + "/_api/web/lists/GetByTitle('CustomGridPOC')/items?$select=folder&$expand=folder",
method: "GET",
        headers: { "Accept": "application/json; odata=verbose" },
        success: function (data)
        {
     
        $.each(data.d.results,function(index,folder){
        if(folder.Folder.Name != undefined)
        {
        var ulTag = $('#root_hierarchy');
        var li = $('<li/>').appendTo(ulTag);
        var a  = $('<a/>').attr('href',folder.Folder.ServerRelativeUrl).appendTo(li);
        var img = $('<img/>').attr('src','./../SiteAssets/Images/folder-icon.png').appendTo(a);
        var span = $('<span/>').text(folder.Folder.Name).appendTo(a);
        }
        });
        }
});
    }

</script>

Monday, June 5, 2017

Get Department for current user using REST API

To get the department property of the logged in user -

http://siteurl/_api/SP.UserProfiles.PeopleManager/GetMyProperties?$select=Department

To get all the properties of another user -

For Office 365/SharePoint Online:
http://siteurl/_api/SP.UserProfiles.PeopleManager/GetUserProfilePropertyFor(accountName=@v,propertyName='Department')?@v='i:0%23.f|membership|user@siteurl.onmicrosoft.com'
For SharePoint 2013 On-Premise:
http://siteurl/_api/SP.UserProfiles.PeopleManager/GetUserProfilePropertyFor(accountName=@v,propertyName='Department')?@v='domain\username'


Clearing Person/Group Values

To clear out or empty the values in person or group columns, how you do it depends on if the column is single-value or multi-value. For ...