I have a requirement where I need to create a new document/library or a new document library view associated with the page when I create a document library page using a custom page layout.

I'm using sharepoint 2010.

Thanks, Lav

  • I was thinking of using a workflow to be associated with create page button. Being a newbee in sharepoint I'd seriously appreciate some help. :)
    – Lav
    Dec 21 '11 at 5:12
  • ok. :) You will need to use custom code to create an event receiver in Visual Studio. After you have finished coding, you can deploy the package (WSP) using Visual Studio or deploy it using PowerShell.
    – Russell
    Dec 21 '11 at 5:16
  • what do you mean by automatically associate?
    – Muhammedh
    Dec 21 '11 at 5:51

You need to create an event receiver to listen for when a page has been created. You attach the event receiver to the Pages library. You can use the server object model to create a document or library.

See these links:

Creating an event receiver:

Creating a document library using the Server OM:

  • You're welcome. :) Glad to help! If it answers your question, feel free to mark as answer.
    – Russell
    Dec 21 '11 at 5:32
  • Any clue on how to automatically associate the created library with the page that I'll create?
    – Lav
    Dec 21 '11 at 5:33
  • You could add a column "Library Name" in the Pages library which is updated when you create the new library.
    – Russell
    Dec 21 '11 at 5:39

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.