| | Hello Mr. MVP can you please reply to my questions,,,,,,"Creating SPContentDatabase programatically
Posted By: Posted Date: October 26, 2010
Points: 0 Category :SharePoint | |
|
|
Hi m trying to Create a SPContentDatabase programatically using Object Model, but getting error of "
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using Microsoft.SharePoint;
using Microsoft.SharePoint.Administration;
using Microsoft.SharePoint.Utilities;
using Microsoft.SharePoint.Deployment;
namespace CreateContentDB
{
public partial class Test2 : System.Web.UI.Page
{
SPWebApplication webApplication;
//SPContentDatabaseCollection contentDBs;
string nameDB = "CNB";
protected void Page_Load(object sender, EventArgs e)
{
}
protected void Button1_Click(object sender, EventArgs e)
{
Uri WebAppUri = new Uri("http://amit:5003");
SPWebApplication webApplication = SPWebApplication.Lookup(WebAppUri);
SPContentDatabaseCollection contentDBs = webApplication.ContentDatabases;
foreach (SPContentDatabase contentDB in contentDBs)
if (contentDB.Status == SPObjectStatus.Online)
{
contentDB.Status = SPObjectStatus.Disabled;
contentDB.Update();
}
CreateContentDatabase(nameDB);
//SPSite siteCollection = webApplication.Sites.Add();
}
private void CreateContentDatabase(string suffix)
{
View Complete Post
|
| More Related Resource Links |
| | | |
|