Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
Deploy app to app catalog using CSOM C# in SharePoint online
string webUrl = "https://tenant-name.sharepoint.com/sites/appcatalog/";
string username = "user.name@tenantname.onmicrosoft.com";
string password = "password";
SecureString secureString = new SecureString();
password.ToList().ForEach(secureString.AppendChar);
var credentials = new SharePointOnlineCredentials(username, secureString);
using (ClientContext ctx = new ClientContext(webUrl))
{
ctx.Credentials = credentials;
var appManager = new AppManager(ctx);
var apps = appManager.GetAvailable();
var chartsApp = apps.Where(a => a.Title == "Charts 365").FirstOrDefault();
var deployApp = appManager.Deploy(chartsApp, true);
//or deploy the app async
var deployAppAsync = await appManager.DeployAsync(chartsApp, true);
}
@hassannawaz456

This comment has been minimized.

Copy link

@hassannawaz456 hassannawaz456 commented Jan 24, 2018

what is appmanager directive or assembly reference ??

@gautamdsheth

This comment has been minimized.

Copy link
Owner Author

@gautamdsheth gautamdsheth commented Jun 11, 2018

@hassannawaz45 - i am using the PnP Core library.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment