SharePoint & Office 365: Compilation of interesting links (IV)!

Every month I use to share all the interesting links and resources I have found about the SharePoint and Office 365 platforms during the previous month. As you can see, this is the fourth compilation of interesting links I publish in English and I hope you find all of them useful.

Features

Development

IT Pro

Office 365

SharePoint 2013: Recopilatorio de enlaces interesantes (LXIII)!

Una vez más, y a la espera de que empiecen a aparecer las primeras noticias sobre SharePoint vNext, os dejo un nuevo recopilatorio de recursos interesantes sobre SharePoint 2013 y sobre todo sobre Office 365.

Capacidades

Desarrollo

IT

Office 365

SharePoint Online: How to do a bulk creation of ODFB Sites using PowerShell!

One of the new features added by Microsoft over the past year to the client object model (CSOM) SharePoint is the possibility of doing massive and asynchronous provisioning of OneDrive To Business (ODFB) sites using the CreatePersonalSiteEnqueueBulk () method of the class ProfileLoader defined in Microsoft.SharePoint.Client.UserProfiles.dll assembly of the CSOM. This method simply requires an array of strings with the e-mails of the Office 365 users we want to be provision ODFB sites as you can see in the script that I created about:  How to do a bulk creation of OneDrive For Business sites in Office 365

############################################################################################################################################

#Script that allows to asynchronously provision OneDrive For Business for a set of users

# Required Parameters:

#  -> $sCSOMPath: Path for the Client Side Object Model for SPO.

#  -> $sUserName: User Name to connect to the SharePoint Online Site Collection.

#  -> $sPassword: Password for the user.

#  -> $sSiteUrl: SharePoint Online Administration Url.

#  -> $ODFBUser: Office 365 user .

############################################################################################################################################

 

$host.Runspace.ThreadOptions = "ReuseThread"

 

#Definition of the function that allows to provision ODFB for a set of users

function Create-ODFBSite

{

    param ($sCSOMPath,$sSiteUrl,$sUserName,$sPassword,$sODFBUsers)

    try

    {    

        Write-Host "----------------------------------------------------------------------------"  -foregroundcolor Green

        Write-Host "Getting the User Profile Information for current user" -foregroundcolor Green

        Write-Host "----------------------------------------------------------------------------"  -foregroundcolor Green

                    

        #Adding the Client OM Assemblies

        $sCSOMRuntimePath=$sCSOMPath +  "\Microsoft.SharePoint.Client.Runtime.dll"  

        $sCSOMUserProfilesPath=$sCSOMPath +  "\Microsoft.SharePoint.Client.UserProfiles.dll"        

        $sCSOMPath=$sCSOMPath +  "\Microsoft.SharePoint.Client.dll"             

        Add-Type -Path $sCSOMPath         

        Add-Type -Path $sCSOMRuntimePath

        Add-Type -Path $sCSOMUserProfilesPath

 

        #SPO Client Object Model Context

        $spoCtx = New-Object Microsoft.SharePoint.Client.ClientContext($sSiteUrl) 

        $spoCredentials = New-Object Microsoft.SharePoint.Client.SharePointOnlineCredentials($sUserName, $sPassword)  

        $spoCtx.Credentials = $spoCredentials        

        $spoUserProfilesLoader=[Microsoft.SharePoint.Client.UserProfiles.ProfileLoader]::GetProfileLoader($spoCtx)     

        $spoUserProfilesLoader.CreatePersonalSiteEnqueueBulk($sODFBUsers)

        $spoUserProfilesLoader.Context.ExecuteQuery()

        $spoCtx.Dispose()

    }

    catch [System.Exception]

    {

        write-host -f red $_.Exception.ToString()   

    }    

}

 

#Required Parameters

$sSiteUrl = "https://<SPO_Site_Url>/" 

$sUserName = "<SPOUser>@<SPO_Domain>.onmicrosoft.com" 

$sPassword = Read-Host -Prompt "Enter your password: " -AsSecureString

$sCSOMPath="<CSOM_Path>"

$sODFBUsers="<SPOUser1>@<SPO_Domain>.onmicrosoft.com","<SPOUser2>@<SPO_Domain>.onmicrosoft.com"

 

Create-ODFBSite -sCSOMPath $sCSOMPath -sSiteUrl $sSiteUrl -sUserName $sUserName -sPassword $sPassword -sODFBUsers $sODFBUsers

To verify that the ODFB sites have been provisioned I recommend the following post of Thomas Balkeståhl: http://blog.blksthl.com/2014/08/08/office-365-guide-series-verify-provisioned-onedrives-using-powershell/

SharePoint Online: Como provisionar de forma masiva ODFB para varios usuarios!

Una de las novedades que incorporó el modelo de objetos en cliente (CSOM) de SharePoint durante el año pasado es la posibilidad de realizar el provisionado masivo y asíncrono de sitios de OneDrive Para Empresas (ODFB) haciendo uso del método CreatePersonalSiteEnqueueBulk() de la clase ProfileLoader definida en el ensamblado Microsoft.SharePoint.Client.UserProfiles.dll del CSOM. Este método simplemente necesita un array de strings con las direcciones de e-mail de los usuarios de Office 365 para los que se va a provisionar ODFB como podéis ver en el script que he creado al respecto: How to do a bulk creation of OneDrive For Business sites in Office 365

############################################################################################################################################

#Script that allows to asynchronously provision OneDrive For Business for a set of users

# Required Parameters:

#  -> $sCSOMPath: Path for the Client Side Object Model for SPO.

#  -> $sUserName: User Name to connect to the SharePoint Online Site Collection.

#  -> $sPassword: Password for the user.

#  -> $sSiteUrl: SharePoint Online Administration Url.

#  -> $ODFBUser: Office 365 user .

############################################################################################################################################

 

$host.Runspace.ThreadOptions = "ReuseThread"

 

#Definition of the function that allows to provision ODFB for a set of users

function Create-ODFBSite

{

    param ($sCSOMPath,$sSiteUrl,$sUserName,$sPassword,$sODFBUsers)

    try

    {    

        Write-Host "----------------------------------------------------------------------------"  -foregroundcolor Green

        Write-Host "Getting the User Profile Information for current user" -foregroundcolor Green

        Write-Host "----------------------------------------------------------------------------"  -foregroundcolor Green

                    

        #Adding the Client OM Assemblies

        $sCSOMRuntimePath=$sCSOMPath +  "\Microsoft.SharePoint.Client.Runtime.dll"  

        $sCSOMUserProfilesPath=$sCSOMPath +  "\Microsoft.SharePoint.Client.UserProfiles.dll"        

        $sCSOMPath=$sCSOMPath +  "\Microsoft.SharePoint.Client.dll"             

        Add-Type -Path $sCSOMPath         

        Add-Type -Path $sCSOMRuntimePath

        Add-Type -Path $sCSOMUserProfilesPath

 

        #SPO Client Object Model Context

        $spoCtx = New-Object Microsoft.SharePoint.Client.ClientContext($sSiteUrl) 

        $spoCredentials = New-Object Microsoft.SharePoint.Client.SharePointOnlineCredentials($sUserName, $sPassword)  

        $spoCtx.Credentials = $spoCredentials        

        $spoUserProfilesLoader=[Microsoft.SharePoint.Client.UserProfiles.ProfileLoader]::GetProfileLoader($spoCtx)     

        $spoUserProfilesLoader.CreatePersonalSiteEnqueueBulk($sODFBUsers)

        $spoUserProfilesLoader.Context.ExecuteQuery()

        $spoCtx.Dispose()

    }

    catch [System.Exception]

    {

        write-host -f red $_.Exception.ToString()   

    }    

}

 

#Required Parameters

$sSiteUrl = "https://<SPO_Site_Url>/" 

$sUserName = "<SPOUser>@<SPO_Domain>.onmicrosoft.com" 

$sPassword = Read-Host -Prompt "Enter your password: " -AsSecureString

$sCSOMPath="<CSOM_Path>"

$sODFBUsers="<SPOUser1>@<SPO_Domain>.onmicrosoft.com","<SPOUser2>@<SPO_Domain>.onmicrosoft.com"

 

Create-ODFBSite -sCSOMPath $sCSOMPath -sSiteUrl $sSiteUrl -sUserName $sUserName -sPassword $sPassword -sODFBUsers $sODFBUsers

Para verificar que los sitios de ODFB han sido provisionados os recomiendo el siguiente post de Thomas Balkeståhl: http://blog.blksthl.com/2014/08/08/office-365-guide-series-verify-provisioned-onedrives-using-powershell/

SharePoint 2013: Uso de la API de Cliente para Flujos de Trabajo (I)!

Dentro de las distintas posibilidades que nos proporciona el Modelo de Objetos en Cliente de SharePoint 2013, tenemos la posibilidad de interactuar con los Flujos de Trabajo desplegados haciendo uso del ensamblado específico que para el Service Pack 1 (SP1) está disponible en la ruta: C:\Program Files\Common Files\microsoft shared\Web Server Extensions\16\ISAPI. En concreto, el ensamblado a utilizar es Microsoft.SharePoint.Client.WorkflowServices.dll. Como ejemplo de uso, el siguiente script permite obtener el estado de ejecución de todos los Flujos de Trabajo desplegados en un sitio de SharePoint 2013 OnPremises (para SharePoint Online, la idea sería la misma). El script, os lo podéis descargar desde la siguiente Url: How get the workflow execution status for all the workflows in a SharePoint Site

$host.Runspace.ThreadOptions = "ReuseThread"

 

#Definition of the function that gets the workflow execution status for all the workflows deployed to a SharePoint Site

function Get-SPSitesInSC

{

    param ($sSiteColUrl,$sUserName,$sDomain,$sPassword,$sCSOMPath)

    try

    {    

        Write-Host "-----------------------------------------------------------------------------------"  -foregroundcolor Green

        Write-Host "Getting the workflow execution status for all the workflows deployed in sSiteColUrl" -foregroundcolor Green

        Write-Host "-----------------------------------------------------------------------------------"  -foregroundcolor Green

     

        #Adding the Client OM Assemblies

        $sCSOMRuntimePath=$sCSOMPath +  "\Microsoft.SharePoint.Client.Runtime.dll"

        $sCSOMWorkflowPath=$sCSOMPath + "\Microsoft.SharePoint.Client.WorkflowServices.dll"

        $sCSOMPath=$sCSOMPath +  "\Microsoft.SharePoint.Client.dll"             

        Add-Type -Path $sCSOMPath         

        Add-Type -Path $sCSOMRuntimePath

        Add-Type -Path $sCSOMWorkflowPath

 

        #SharePoint Client Object Model Context

        $spCtx = New-Object Microsoft.SharePoint.Client.ClientContext($sSiteColUrl) 

        $spCredentials = New-Object System.Net.NetworkCredential($sUserName,$sPassword,$sDomain)  

        $spCtx.Credentials = $spCredentials 

 

        if (!$spCtx.ServerObjectIsNull.Value) 

        {

            $spWeb = $spCtx.Web

            $spLists = $spWeb.Lists

            $spCtx.Load($spLists);

            $spCtx.ExecuteQuery();

 

            $spWorkflowServicesManager = New-Object Microsoft.SharePoint.Client.WorkflowServices.WorkflowServicesManager($spCtx, $spWeb);

            $spWorkflowSubscriptionService = $spWorkflowServicesManager.GetWorkflowSubscriptionService();

            $spWorkflowInstanceSevice = $spWorkflowServicesManager.GetWorkflowInstanceService();

            

            Write-Host ""

            Write-Host "Getting all the Lists in $sSiteColUrl" -ForegroundColor Green

            Write-Host ""

 

            foreach ($spList in $spLists)         

            {   

                $spWorkflowSubscriptions = $spWorkflowSubscriptionService.EnumerateSubscriptionsByList($spList.Id);

                $spCtx.Load($spWorkflowSubscriptions);                

                $spCtx.ExecuteQuery();                

                foreach($spWorkflowSubscription in $spWorkflowSubscriptions)

                {            

                    Write-Host "**************************************************************************************"

                    Write-Host "List: "$spList.Title " - Workflow: "$spWorkflowSubscription.Name -ForegroundColor Green

                    Write-Host "***************************************************************************************"

                    Write-Host ""

 

                    $spCamlQuery = New-Object Microsoft.SharePoint.Client.CamlQuery

                    $spCamlQuery.ViewXml = "<View> <ViewFields><FieldRef Name='Title' /></ViewFields></View>";

                    $spListItems = $spList.GetItems($spCamlQuery);

                    $spCtx.Load($spListItems);

                    $spCtx.ExecuteQuery();

 

                    foreach($spListItem in $spListItems)

                    {

                        $spWorkflowInstanceCollection = $spWorkflowInstanceSevice.EnumerateInstancesForListItem($spList.Id,$spListItem.Id);

                        $spCtx.Load($spWorkflowInstanceCollection);

                        $spCtx.ExecuteQuery();

                        foreach ($spWorkflowInstance in $spWorkflowInstanceCollection)

                        {

                           Write-Host "List Item Title:"$spListItem["Title"] 

                           Write-Host "Workflow Status:"$spWorkflowInstance.Status 

                           Write-Host "Last Workflow Execution:"$spWorkflowInstance.LastUpdated

                           Write-Host ""

                        }

                    }                   

                    Write-Host ""

                }

            }

              

            $spCtx.Dispose() 

        }        

    }

    catch [System.Exception]

    {

        write-host -f red $_.Exception.ToString()   

    }    

}

 

#Required Parameters

$sSiteColUrl = "http://<SiteUrl>/" 

$sUserName = "<SharePointUser>" 

$sDomain="<OnPremisesDomain>"

$sPassword ="<Password>" 

$sCSOMPath="C:\Program Files\Common Files\microsoft shared\Web Server Extensions\16\ISAPI"

 

Get-SPSitesInSC -sSiteColUrl $sSiteColUrl -sUserName $sUserName -sDomain $sDomain -sPassword $sPassword -sCSOMPath $sCSOMPath

La salida por pantalla que se genera es la siguiente:

image

SharePoint Online: Como habilitar vínculos anónimos a documentos en sitios!

Al igual que sucede con documentos almacenados en OneDrive para Empresas, es posible habilitar vínculos anónimos a documentos almacenados en sitios de SharePoint Online siempre y cuando hayamos realizado unas configuraciones previas en el tenant:

  • En primer lugar, verificamos que el sitio de SharePoint Online está configurado para poder invitar a usuarios externos a través de la opción que permite crear vínculos anónimos: Allow both external users who accept sharing invitations and anonymous guest links
  • De esta forma, ya podremos generar vínculos para compartir cualquier documento del sitio bien para su lectura, bien para su lectura y edición.

image

image

[SUGES]: Disponibles para descarga los materiales de los últimos WebCasts!

Ya tenéis disponible para descarga los materiales de los dos últimos WebCasts que hemos realizado en SUGES. Agradecer de nuevo a los ponentes (Hans, Alberto Díaz y Adrián Díaz) el esfuerzo realizado y a los asistentes el interés mostrado en los temas tratados. Los materiales los podéis encontrar en el sitio web de SUGES:

image