Wednesday, November 18, 2015

How to use Iframe under SharePoint

I have a sharepoint site : ABC.com\index.aspx this needs to show the content of another SharePoint site DEF.com\Index.aspx Changes need to be done in the Master page of DEF.com site Add the below tag in the head part of the MP.
 <WebPartPages:AllowFraming ID="AllowFraming" runat="server" __WebPartId="{E5EA0CB9-8180-485C-985F-51B4DEB34CC4}" />

Friday, November 13, 2015

Find current login user in sharepoint users group using REST and render output as HTML


$(document).ready(function ()  
{ 
 getCurrentUser(); 
 
}); 
 
function getCurrentUser()   
{  
 $.ajax
 ({  
  url: url+"/_api/web/CurrentUser",  
  method: "GET",  
  headers: { "Accept": "application/json; odata=verbose" },  
  success: function (data)  
  {  
   getCurrentUserGroupColl(data.d.Id);  
  },  
  error: function (data)   
  {  
   failure(data);  
  }  
 });  
}
  
function getCurrentUserGroupColl(UserID)   
{  
 $.ajax  
  ({  
   url: url+"/_api/web/GetUserById(" + UserID + ")/Groups",  
   method: "GET",  
   headers: { "Accept": "application/json; odata=verbose" },  
   success: function (data) 
   {  
   /* get all group's title of current user. */  
   var results = data.d.results; 
   var InnrHtmlgrp = "<br />
<ul>";  
   
   for (var i = 0; i &lt; results.length; i++)   
   {  
    if(results[i].Title == 'owner')
    {
    // Do the changes 
    //InnrHtmlgrp += "
<li>" + results[i].Title + "</li>
";  
    $("#manager").append(managerstring);  
    
    }
   }  
  
    
   }  
  });  
}

HTML

Script:

JS