public async Task <HttpResponseMessage> InstallAppAsync(string customerId, string userId) { if (string.IsNullOrEmpty(customerId)) { throw new ArgumentNullException(nameof(customerId)); } if (string.IsNullOrEmpty(userId)) { throw new ArgumentNullException(nameof(userId)); } GraphContext graph; ExchangeContext context; IUser user; try { graph = new GraphContext(customerId); user = await graph.Client.Users.GetByObjectId(userId).ExecuteAsync(); context = new ExchangeContext(customerId, user.Mail); context.InstallApp("PartnerCenter.Samples.AOBO.Manifests.HelloWorld.HelloWorld.xml"); return(new HttpResponseMessage(HttpStatusCode.NoContent)); } finally { context = null; graph = null; user = null; } }