Category Archives: PowerShell

Automated Testing Challenges for SharePoint Apps – Trusting the app!

Many architects are trying to establish a fully automated continuous deployment process for their SharePoint apps. While automating the build, packaging & deployment is fairly simple (check this), there is a big challenge that is preventing architects and developers from reaching the full automation stage. That’s is “Trusting the App“!

Following the deployment of the application components (to pre-prod environments), it is important to note that before anyone accessing the application, including automated tests that may be part of the build, a tenant (or site collection) administrator will have to trust the application on the app information page in SharePoint. This is usually a manual process and there is no way to trust your app through PowerShell or .NET CSOM but there is a trick that I use for achieving a full automation! PowerShell IE Automation!

Here is the script that I use from within my deployment script:

$url = “$($web.Url.TrimEnd(‘/’))/_layouts/15/appinv.aspx?AppInstanceId={$($appInstance.Id)}”
     $ie = New-Object -com internetexplorer.application
        while ($ie.busy)
             sleep -milliseconds 60
         $trustButton = $ie.Document.getElementById(“ctl00_PlaceHolderMain_BtnAllow”)         
         sleep -Seconds 1
         Write-Host “App was trusted successfully!”
   throw (“Error Trusting App”);

You just need to add the code above to your deployment script and VOILA. You no longer need to suspend the testing process until the application is trusted. Now a completely “Build-Deploy-Test workflow” is possible!

Finally, I would like to give some credit to Alexander Brassington, his blog post about automated publishing for content types using PowerShell IE Automation inspired me. Although, the post is completely unrelated to Build Automation, it helped a lot on coming up with the workaround!


[SharePoint4MEA : Arabic Video] Windows PowerShell for Office 365 SharePoint Online

This is a quick note to let you know that I’ve just published a new video to SharePoint4MEA YouTube channel.

Today’s video is about Managing Office 365 SharePoint Online through the SharePoint Online PowerShell Management Shell. You can watch the video from here.




For more about the PowerShell Module, you can check the following articles :