Get O365 user license and blocked status using CSOM RRS feed

  • Question

  • Hi,

    I have to check if a user exists in O365 and check if it has a valid license and if it is Blocked or not (Sign-in status).

    I am able to get all the user list from sharepoint using CSOM (UserCollection users = clientContext.Web.SiteUsers)

    Also i'm able to get all the user properties PersonProperties properties = peopleManager.GetPropertiesFor(user); 

    But the above 2 queries doesnot have any property named IsLicensed or IsBlocked.

    With powershell Get-MsolUser, this returns IsLicensed property. What is its equivalent in CSOM?

    1. If I login to the portal via browser, i see the Status column which says Unlicensed or E3 license. How to get this property in CSOM?

    2. If a click on a user i see Sign-in status as Sign-in allowed or Sign-in blocked. How to get this property in CSOM?

    I'm relatively new to CSOM api.

    Please help.


    Wednesday, January 18, 2017 1:20 PM