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 ...