Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
using Microsoft.SharePoint.Client;
using OfficeDevPnP.Core.ALM;
using OfficeDevPnP.Core.Pages;
using OfficeDevPnP;
public void DeploySingleApp(Guid appId)
{
using (ClientContext context = new ClientContext(<SiteUrl>))
{
context.Credentials = new SharePointOnlineCredentials(UserName, SecurePass);
AppManager manager = new AppManager(context);
if (manager.Deploy(appId, true))
{
if (manager.GetAvailable(appId) != null)
{
try
{
Task installTask = Task.Run(async () => await manager.InstallAsync(appId));
installTask.Wait();
}
catch (Exception ex)
{
log.Info("Exception Caught - Mostly because the App is already installed. Skipping Install. Message - " + ex.InnerException.Message);
}
}
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.