Logo 
Search:

MOSS Forum

Ask Question   UnAnswered
Home » Forum » MOSS       RSS Feeds

Link to Create Instance of New Document-based Content Type

  Asked By: Naman    Date: Nov 29    Category: MOSS    Views: 15377

I'd like to code, in html, a link that creates an instance of a Content
Type in a document library from a web part page.

Put another way, I want to steal the action triggerred when you pull
down the New Document menu on the Library Tools' Documents ribbon and
click "My Document Based Content Type."

This needs to open MS Word with the appropriate template as specified by
the content type and save to the appropriate library.

I've seen this:

<A onfocus="OnLink(this)" HREF="/sites/Concept/Templates/Document.docx"
onclick="createNewDocumentWithProgID('https:\u002f\u002fshared.com\u002f\
sites\u002fConcept\u002520Templates\u002fTest.xls,
'https:\u002f\u002fshared.com\u002fsites\u002fConcept\u002f55555\u002fTe\
mplates', 'SharePoint.OpenDocuments', false)"> My Document<img
src="/_layouts/images/blank.gif" class="ms-hidden" border=0 width=1
height=1 alt="Use SHIFT+ENTER to open the menu (new window)."></A>

But it doesn't seem to want to work in SPF 2010

Share: 

 

1 Answer Found

 
Answer #1    Answered By: Siobhan Waller     Answered On: Nov 29

Most of the escape characters aren't needed. Drop this in a content editor and
then click on the link

<A onfocus="OnLink(this)" HREF="XXX Item 1 XXX"
onclick="createNewDocumentWithProgID('XXX ITEM 2 XXX', 'XXX ITEM 3 XXX',
'SharePoint.OpenDocuments', false)">Create Instance of Content Type in Specified
Library</A>

"XXX ITEM 1 XXX" = Relative path to template in
\Site\Subsite\library\forms\content type\ folder, i.e.
"/SiteDirectory/My%20Site/My%20Library/Forms/My%20Content%20Type/Template%20File\
%20Name.docx" Use %20 for blank spaces.

'XXX ITEM 2 XXX' = Full path to template in \content type folder. Use single
quotes.

'XXX ITEM 3 XXX' = Full path to host library. In my example above, that would be
'http://MyDomain.com//SiteDirectory/My%20Site/My%20Library'. Again use single
quotes.

 
Didn't find what you were looking for? Find more on Link to Create Instance of New Document-based Content Type Or get search suggestion and latest updates.




Tagged: