Friday, March 8, 2013

Create DiscussionBoard Programatically

[Code]

   private void CreateDiscussionBoardListToSite(SPWeb oWeb,string listNameEn,string listDescEn,string listNameAr,string listDescAr)        {            SPList list = oWeb.Lists.TryGetList(listNameEn);            if (list!=null) return;
            oWeb.AllowUnsafeUpdates = true;            Guid listId = oWeb.Lists.Add(listNameEn, listDescEn, SPListTemplateType.DiscussionBoard);            SPList createdList = oWeb.Lists[listId];            createdList.OnQuickLaunch = true;
            createdList.TitleResource.SetValueForUICulture(new CultureInfo(1033), listNameEn);            createdList.TitleResource.SetValueForUICulture(new CultureInfo(1025), listNameAr);            createdList.TitleResource.Update();
            createdList.DescriptionResource.SetValueForUICulture(new CultureInfo(1033), listDescEn);            createdList.DescriptionResource.SetValueForUICulture(new CultureInfo(1025), listDescAr);            createdList.DescriptionResource.Update();
         
            createdList.Update();        }

No comments:

Post a Comment