Logo 
Search:

Sharepoint Forum

Ask Question   UnAnswered
Home » Forum » Sharepoint       RSS Feeds

Create a blank webpart page programatically?

  Asked By: Jean    Date: Jan 07    Category: Sharepoint    Views: 3714

How to create a blank webpart page and add it to document library programatically?
Pls help.

Share: 

 

3 Answers Found

 
Answer #1    Answered By: Lynn Mann     Answered On: Jan 07

please elaborate requirement.............

 
Answer #2    Answered By: Alka Sarabhai     Answered On: Jan 07

Check this out..
string newFilename = "Manoj.aspx";
string templateFilename = "spstd1.aspx";

string hive = SPUtility.GetGenericSetupPath("TEMPLATE\\1033\\STS\\DOCTEMP\\SMARTPGS\\");
FileStream stream = new FileStream(hive + templateFilename, FileMode.Open);
using (SPSite site = new SPSite("http://sharepoint"))
using (SPWeb web = site.OpenWeb())
{
SPFolder libraryFolder = web.GetFolder("MyDocumetLibraryName");
SPFileCollection files = libraryFolder.Files;
SPFile newFile = files.Add(newFilename, stream);
}

 
Answer #3    Answered By: Eashan Nadkarni     Answered On: Jan 07

Simple requirement - just bing it and get it done

 
Didn't find what you were looking for? Find more on Create a blank webpart page programatically? Or get search suggestion and latest updates.




Tagged: