usuario son sitio sincronizan sesión qué permisos perfiles niveles los inicia imagen hacerlo elementos cómo cuáles como cambiar sharepoint sharepoint-2013 sharepoint-online

son - niveles de permisos en sharepoint 2013



Obteniendo TODOS los usuarios del inquilino en línea de SharePoint y estableciendo la propiedad de perfil de usuario a través de Powershell (1)

Como mencionó, no hay formas sencillas de obtener todos los perfiles de usuario dentro del inquilino de SharePoint utilizando SharePoint Online CSOM API. Pero podrías considerar el siguiente enfoque:

Ejemplo

Add-Type -Path "C:/Program Files/Common Files/Microsoft Shared/Web Server Extensions/16/ISAPI/Microsoft.SharePoint.Client.dll" Add-Type -Path "C:/Program Files/Common Files/Microsoft Shared/Web Server Extensions/16/ISAPI/Microsoft.SharePoint.Client.Runtime.dll" Add-Type -Path "C:/Program Files/Common Files/Microsoft Shared/Web Server Extensions/16/ISAPI/Microsoft.SharePoint.Client.UserProfiles.dll" Function Get-SPOContext([string]$Url,[string]$UserName,[string]$Password) { $context = New-Object Microsoft.SharePoint.Client.ClientContext($Url) $context.Credentials = Get-SPOCredentials -UserName $UserName -Password $Password return $context } Function Get-SPOCredentials([string]$UserName,[string]$Password) { $SecurePassword = $Password | ConvertTo-SecureString -AsPlainText -Force return New-Object Microsoft.SharePoint.Client.SharePointOnlineCredentials($UserName, $SecurePassword) } Function Print-UserProfileInfo([Microsoft.SharePoint.Client.UserProfiles.PeopleManager]$PeopleManager,[string]$AccountName){ $ctx = $PeopleManager.Context $accountName = "i:0#.f|membership|" + $AccountName #claim format $userProfile = $PeopleManager.GetPropertiesFor($AccountName) $ctx.Load($userProfile) $ctx.ExecuteQuery() Write-Host $userProfile.PersonalUrl } $tenantUrl = "https://contoso.sharepoint.com/" $userName = "[email protected]" $password = "password" $secPassword = ConvertTo-SecureString $password -AsPlainText -Force $cred = New-Object System.Management.Automation.PSCredential ($userName, $secPassword) Connect-MsolService -Credential $cred $allUsers = Get-MsolUser $Context = Get-SPOContext -Url $tenantUrl -UserName $userName -Password $password $peopleManager = New-Object Microsoft.SharePoint.Client.UserProfiles.PeopleManager($Context) $allUsers | % { Print-UserProfileInfo -PeopleManager $peopleManager -AccountName $_.UserPrincipalName } $Context.Dispose()

ACTUALIZAR:

Vadim tiene una buena respuesta a continuación, pero así es como lo hice:

namespace UserProfile.Manipulation.CSOM.Console { class Program { static void Main(string[] args) { searchAllUsers(); } private static void searchAllUsers() { string siteCollectionUrl = "https://tenant.sharepoint.com/sites/intranet"; string tenantAdminLoginName = "adminlogin"; string tenantAdminPassword = "Password"; using (ClientContext clientContext = new ClientContext(siteCollectionUrl)) { SecureString passWord = new SecureString(); foreach (char c in tenantAdminPassword.ToCharArray()) passWord.AppendChar(c); clientContext.Credentials = new SharePointOnlineCredentials(tenantAdminLoginName, passWord); KeywordQuery keywordQuery = new KeywordQuery(clientContext); keywordQuery.QueryText = "*"; keywordQuery.SourceId = new Guid("B09A7990-05EA-4AF9-81EF-EDFAB16C4E31"); keywordQuery.TrimDuplicates = false; keywordQuery.RowLimit = 500; //startrow changed 3 times since 500 limitations. keywordQuery.StartRow = 1001; SearchExecutor searchExecutor = new SearchExecutor(clientContext); ClientResult<ResultTableCollection> results = searchExecutor.ExecuteQuery(keywordQuery); clientContext.ExecuteQuery(); foreach (var resultRow in results.Value[0].ResultRows) { SetSingleValueProfileProperty(resultRow["AccountName"].ToString()); } } } private static void SetSingleValueProfileProperty(string accountName) { string tenantAdministrationUrl = "https://tentnatname-admin.sharepoint.com"; string tenantAdminLoginName = "adminlogin"; string tenantAdminPassword = "password"; string UserAccountName = accountName; using (ClientContext clientContext = new ClientContext(tenantAdministrationUrl)) { SecureString passWord = new SecureString(); foreach (char c in tenantAdminPassword.ToCharArray()) passWord.AppendChar(c); clientContext.Credentials = new SharePointOnlineCredentials(tenantAdminLoginName, passWord); PeopleManager peopleManager = new PeopleManager(clientContext); peopleManager.SetSingleValueProfileProperty(UserAccountName, "SPS-PicturePlaceholderState", "1"); clientContext.ExecuteQuery(); } } }

}

Necesito establecer una propiedad en TODOS los perfiles de usuario dentro de un inquilino.

¿No parece posible obtener todos los perfiles de usuario de "UPA" a través de CSOM y powershell?

Es posible (en teoría) realizar un bucle a través de todas las colecciones de sitios y agregar todos los usuarios a alguna matriz y luego seleccionar solo una única de esa matriz (para eliminar duplicados):

$sites = Get-SPOSite | select * foreach ($site in $sites) { Get-SPOUser -Site $site

...y así

Y luego recorra esa matriz y use csom:

$pMAn = New-Object Microsoft.SharePoint.Client.UserProfiles.PeopleManager($context) $userProfile = $pMan.GetPropertiesFor($user.LoginName) $ctx.Load($userProfile) $ctx.ExecuteQuery() $pMan.SetSingleVlueProfileProperty($userProfile.AccountName, "property", $value) $ctx.ExecuteQuery()

¿Alguien que pueda pensar en una solución más inteligente?