Quantcast
Channel: SharePoint 2013 - Development and Programming forum
Viewing all articles
Browse latest Browse all 7589

Check if userid is already in claims mode

$
0
0

Hi,

How to check if user account id (domain\username) is already converted to claims account?

I have tried the below code:

SPClaimProviderManager ClaimManager = SPClaimProviderManager.Local; if (ClaimManager != null) { try {

string strUserLanID;

SPClaim claim = new SPClaim(SPClaimTypes.UserLogonName, strUserLanID, "http://www.w3.org/2001/XMLSchema#string", SPOriginalIssuers.Format(SPOriginalIssuerType.Windows)); strUserLanID = ClaimManager.EncodeClaim(claim); } catch (Exception ex) { } }

If the strUserLanID is of type "domain\username", the above code works, but if the strUserLanID is of type "i:0#.w|domain\username", then i get the error as username is not unique. How to check if the userid is already in claims mode?

Thanks


Viewing all articles
Browse latest Browse all 7589

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>