Showing posts with label SharePoint Online. Show all posts
Showing posts with label SharePoint Online. Show all posts

Thursday, November 30, 2023

Get SharePoint all users from in the Group Using the Group Name or Group Id

 In this blog I am explaining how to get all uses form SharePoint group using Name and Id with REST

Get All Users from Groups Name

"_api/web/sitegroups/getbyname('" + groupname + "')/users/"

Get All Users from Groups ID

"/_api/web/sitegroups/GetById(" + groupID +")/Users"

Suppose If you getting Groupe Name from textbox and in will contain special character such as "&" or you can use the Group-id method

var groupName = encodeURIComponent(groupname);
_spPageContextInfo.webAbsoluteUrl + "/_api/web/sitegroups?
                    $filter=LoginName eq '" + groupName + "'"

Additionally If you need to group details related to the the login user use following method

"/_api/web/sitegroups?$filter=substringof('" + groupname + "',LoginName)"



Saturday, September 18, 2021

Apply SharePoint Template to site in SharePoint Online

 This article describes applying a built-in template to the site. Following are the steps.


Go to the preferred site that you need to add a custom theme and click on the gear wheel in suite bar.


Then You will able to see the “Apply a site template” under the Settings.



When it displays the "Select a template" you are able to see two tabs. 

"From Microsoft":- by default when we are creating the team site it will apply a "Team collaboration" template other than that Microsoft has introduced Event Planning, Project Management, Training and courses, Training and development team. According to your requirement.

"From your organization":- Some organisations have built their own custom template in this section you can select the organisation level custom theme.



Select the preferred template to apply. For example, I select a Project management template to show you. then it displays the "Preview and apply template" window explaining the capabilities of the template.


 Click on the "Use template" button to apply the template.


After applying the template site will look like following



Once the template is added as it explains according to the scenario it has generated the relevant list to cater for it. Presently, for project management template, it has added following list.















Tuesday, August 6, 2019

_spPageContextInfo in JavaScript object model

What is _spPageContextInfo SharePoint JavaScript Object Model?

In JavaScript Object Model _spPageContextInfo is a main object use to key values like user name, siteurl, userid,etc. 

  • _spPageContextInfo.webabsoluteurl - Absolute URL of the current Web
  • _spPageContextInfo.userid - User Id of login user
  • _spPageContextInfo.userloginname - user name of login user

You can learn more about the _spPageContextInfo for followings blog codesharepoint.com

In some occasions  "_spPageContextInfo is not defined" error occurs in above error explain in above also