SP.Web.ensureUser Method (sp.js)

Checks whether the specified login name belongs to a valid user in the site. If the user doesn't exist, adds the user to the site.

Applies to: apps for SharePoint | SharePoint Foundation 2013 | SharePoint Server 2013



  • logonName
    Type: String

    The login name of the user.

Return value

Type: SP.User

The user with the specified login name.


This method does not add a user with the specified login name to the website if that user is already on the website.

REST resource endpoint

See Web resource for more information.

Endpoint URI structure


HTTP requests

This resource supports the following HTTP commands:

  • POST

POST syntax

POST http://<sitecollection>/<site>/_api/web/ensureUser(logonName)

Resource parameters

  • logonName