protected void CreateLibrary_Click(object sender, EventArgs e) { try { var _spContext = SharePointContextProvider.Current.GetSharePointContext(Context); var _templateSelectedItem = this.DocumentTemplateType.Value; var _libraryToCreate = this.GetLibraryToCreate(); using (var _ctx = _spContext.CreateUserClientContextForSPHost()) { //TODO Change your application name _ctx.ApplicationName = "ECM.DocumentLibraries"; ContentTypeManager _manager = new ContentTypeManager(); switch(_templateSelectedItem) { case "IT Document": _manager.CreateITDocumentLibrary(_ctx, _libraryToCreate); break; case "Contoso Document": _manager.CreateContosoDocumentLibrary(_ctx, _libraryToCreate); break; } } Response.Redirect(this.Url.Value); } catch (Exception _ex) { throw; } }
protected void CreateLibrary_Click(object sender, EventArgs e) { try { var _spContext = SharePointContextProvider.Current.GetSharePointContext(Context); var _templateSelectedItem = this.DocumentTemplateType.Value; var _libraryToCreate = this.GetLibraryToCreate(); using (var _ctx = _spContext.CreateUserClientContextForSPHost()) { //TODO Change your application name _ctx.ApplicationName = "AMS ECM.DocumentLibraries"; ContentTypeManager _manager = new ContentTypeManager(); switch (_templateSelectedItem) { case "IT Document": _manager.CreateITDocumentLibrary(_ctx, _libraryToCreate); break; case "Contoso Document": _manager.CreateContosoDocumentLibrary(_ctx, _libraryToCreate); break; } } Response.Redirect(this.Url.Value); } catch (Exception _ex) { throw; } }
private void SetContentTypes() { ContentTypeManager _manager = new ContentTypeManager(); var _contentTypes = _manager.GetContentTypesName(); this.DocumentTemplateType.DataSource = _contentTypes; this.DocumentTemplateType.DataBind(); }