views:

31

answers:

1

Does anyone know a Sharepoint 2010 API for adding a new trusted identity token issuer (aka identity provider)?

I can do this using the PS cmdlet New-SPTrustedIdentityTokenIssuer, but I need to do it from C# code.

A: 

Hi Martin

If you open Microsoft.SharePoint.Powershell.dll in .Net Reflector it reveals that the implementation if SPCmdletNewTrustedServiceTokenIssuer is:

protected override SPTrustedAccessProvider CreateDataObject()
{
  SPSecurityTokenServiceManager localOrThrow = SPSecurityTokenServiceManager.LocalOrThrow;
  SPTrustedAccessProvider newObj = new SPTrustedAccessProvider(localOrThrow, this.Name, this.Description, this.Certificate);
  localOrThrow.TrustedAccessProviders.Add(newObj);
  return newObj;
}

SPSecurityTokenServiceManager.LocalOrThrow is internal but just calls Local

Per Jakobsen