From: Doug Robbins - Word MVP on 18 May 2010 06:14 I guess that is not the path that you are wanting to obtain? -- Hope this helps. Please reply to the newsgroup unless you wish to avail yourself of my services on a paid consulting basis. Doug Robbins - Word MVP, originally posted via msnews.microsoft.com "Mo" <Mo(a)discussions.microsoft.com> wrote in message news:E48F7A6E-A087-4A31-BDE5-B91D59667E47(a)microsoft.com... > Thanks again, > > it has a template and the path to it is > "http://poweredge-r210/Documents/Forms/Sida > brevmall/SP2010StartTemplate.dotm > " > > /P > > "Doug Robbins - Word MVP" wrote: > >> Does the document have a template attached to it, other than the Normal >> Template? >> >> What is displayed if you run a macro containing the following code on >> such a >> document? >> >> Set myTemplate = ActiveDocument.AttachedTemplate >> MsgBox myTemplate.Path & Application.PathSeparator _ >> & myTemplate.Name >> >> >> -- >> Hope this helps. >> >> Please reply to the newsgroup unless you wish to avail yourself of my >> services on a paid consulting basis. >> >> Doug Robbins - Word MVP, originally posted via msnews.microsoft.com >> >> "Mo" <Mo(a)discussions.microsoft.com> wrote in message >> news:76C40307-4491-4017-A72B-B9FC2504C53C(a)microsoft.com... >> > Hi and thanks, >> > >> > The document is, and could be, created from any document library in >> > SP2010. >> > There is a content type that has a .dotm as the template for that >> > content >> > type. >> > >> > When you create a new document from within SP2010, it opens up in Word >> > as >> > "Document 1" and it doesn't yet have any name, so any .path or >> > .fullname >> > doesn't work. >> > >> > I have browsed through the xml of the document, both internally via >> > .WordOpenXML property and externally by examining the .zip structure, >> > but >> > haven't found any references ther to the document library the document >> > is >> > created from. >> > >> > Somehow there is a connection, because when you save the document, Word >> > proposes the correct document library. It seems like there is an event >> > handler in SP2010 that has a handle to to the document. Is there any >> > way >> > to >> > "take over" that handle to the newly created document? >> > >> > In Word, if you save the first created document, the one that I don't >> > want, >> > and then save the second document - the one created via code in the >> > first >> > document, Word remembers the last save and suggests the same document >> > library. But I don't want to save the first document, so that is not an >> > option. >> > >> > TIA, >> > Peeter >> > >> > "Doug Robbins - Word MVP" wrote: >> > >> >> How is the document actually being created? From a template or by >> >> opening a >> >> document? Have you tried using the .FullName attribute of the attached >> >> template or of the file? >> >> >> >> -- >> >> Hope this helps. >> >> >> >> Please reply to the newsgroup unless you wish to avail yourself of my >> >> services on a paid consulting basis. >> >> >> >> Doug Robbins - Word MVP, originally posted via msnews.microsoft.com >> >> >> >> "Mo" <Mo(a)discussions.microsoft.com> wrote in message >> >> news:086332A8-E7E1-40D3-9273-B00FC5EB6449(a)microsoft.com... >> >> > Hi, >> >> > When creating a new Word document from a library in Sharepoint and >> >> > then >> >> > saving it from Word, it suggests to save it in that same library I >> >> > created >> >> > the document from. I would like to know how Word "knows" which >> >> > library >> >> > to >> >> > suggest? Can I find that information programatically? >> >> > >> >> > What I want to achieve is that the created document programatically >> >> > creates >> >> > another new document and saves it to the same library as the >> >> > original >> >> > document was created from. And I don't intend to save the first >> >> > created >> >> > document. I know how to do this except to find the path to the >> >> > library. >> >> > >> >> > Any help is highly appreciated, >> >> > >> >> > Peeter >> >> >> >> . >> >>
From: Mo on 18 May 2010 09:55 No :-) But it seems that in every document library you add contentTypes with an attached template, the templates end up in a subdirectory that starts with "/Forms" etc to that document library. So, for now I'm on that track. Next thing I want to solve :-) When the user saves a document to a document library, that is not created from within SP2010, she is asked to apply one of the possible contentTypes from a list. As we in our situation know which contentType we want the user to pick, we want to remove that step for the user. Is there a way, via the Word object model, to set the desired contentType? I have not found any explicit property for that. Via ActiveDocument.ContentTypeProperties.SchemaXml you can get information but it is a read-only property. Is it possible and what is required to manipulate the entire xml which can be reached via ActiveDocument.WordOpenXML? Or is there another way? Thanks, Peeter "Doug Robbins - Word MVP" wrote: > I guess that is not the path that you are wanting to obtain? > > -- > Hope this helps. > > Please reply to the newsgroup unless you wish to avail yourself of my > services on a paid consulting basis. > > Doug Robbins - Word MVP, originally posted via msnews.microsoft.com > > "Mo" <Mo(a)discussions.microsoft.com> wrote in message > news:E48F7A6E-A087-4A31-BDE5-B91D59667E47(a)microsoft.com... > > Thanks again, > > > > it has a template and the path to it is > > "http://poweredge-r210/Documents/Forms/Sida > > brevmall/SP2010StartTemplate.dotm > > " > > > > /P > > > > "Doug Robbins - Word MVP" wrote: > > > >> Does the document have a template attached to it, other than the Normal > >> Template? > >> > >> What is displayed if you run a macro containing the following code on > >> such a > >> document? > >> > >> Set myTemplate = ActiveDocument.AttachedTemplate > >> MsgBox myTemplate.Path & Application.PathSeparator _ > >> & myTemplate.Name > >> > >> > >> -- > >> Hope this helps. > >> > >> Please reply to the newsgroup unless you wish to avail yourself of my > >> services on a paid consulting basis. > >> > >> Doug Robbins - Word MVP, originally posted via msnews.microsoft.com > >> > >> "Mo" <Mo(a)discussions.microsoft.com> wrote in message > >> news:76C40307-4491-4017-A72B-B9FC2504C53C(a)microsoft.com... > >> > Hi and thanks, > >> > > >> > The document is, and could be, created from any document library in > >> > SP2010. > >> > There is a content type that has a .dotm as the template for that > >> > content > >> > type. > >> > > >> > When you create a new document from within SP2010, it opens up in Word > >> > as > >> > "Document 1" and it doesn't yet have any name, so any .path or > >> > .fullname > >> > doesn't work. > >> > > >> > I have browsed through the xml of the document, both internally via > >> > .WordOpenXML property and externally by examining the .zip structure, > >> > but > >> > haven't found any references ther to the document library the document > >> > is > >> > created from. > >> > > >> > Somehow there is a connection, because when you save the document, Word > >> > proposes the correct document library. It seems like there is an event > >> > handler in SP2010 that has a handle to to the document. Is there any > >> > way > >> > to > >> > "take over" that handle to the newly created document? > >> > > >> > In Word, if you save the first created document, the one that I don't > >> > want, > >> > and then save the second document - the one created via code in the > >> > first > >> > document, Word remembers the last save and suggests the same document > >> > library. But I don't want to save the first document, so that is not an > >> > option. > >> > > >> > TIA, > >> > Peeter > >> > > >> > "Doug Robbins - Word MVP" wrote: > >> > > >> >> How is the document actually being created? From a template or by > >> >> opening a > >> >> document? Have you tried using the .FullName attribute of the attached > >> >> template or of the file? > >> >> > >> >> -- > >> >> Hope this helps. > >> >> > >> >> Please reply to the newsgroup unless you wish to avail yourself of my > >> >> services on a paid consulting basis. > >> >> > >> >> Doug Robbins - Word MVP, originally posted via msnews.microsoft.com > >> >> > >> >> "Mo" <Mo(a)discussions.microsoft.com> wrote in message > >> >> news:086332A8-E7E1-40D3-9273-B00FC5EB6449(a)microsoft.com... > >> >> > Hi, > >> >> > When creating a new Word document from a library in Sharepoint and > >> >> > then > >> >> > saving it from Word, it suggests to save it in that same library I > >> >> > created > >> >> > the document from. I would like to know how Word "knows" which > >> >> > library > >> >> > to > >> >> > suggest? Can I find that information programatically? > >> >> > > >> >> > What I want to achieve is that the created document programatically > >> >> > creates > >> >> > another new document and saves it to the same library as the > >> >> > original > >> >> > document was created from. And I don't intend to save the first > >> >> > created > >> >> > document. I know how to do this except to find the path to the > >> >> > library. > >> >> > > >> >> > Any help is highly appreciated, > >> >> > > >> >> > Peeter > >> >> > >> >> . > >> >>
From: Doug Robbins - Word MVP on 18 May 2010 17:14 Sorry, I do not know anything about Sharepoint, so I have cross posted this to several of the Sharepoint newsgroups where it may be seen by someone who can help you further. -- Hope this helps. Please reply to the newsgroup unless you wish to avail yourself of my services on a paid consulting basis. Doug Robbins - Word MVP, originally posted via msnews.microsoft.com "Mo" <Mo(a)discussions.microsoft.com> wrote in message news:D6AEC356-A032-485B-9C5E-B18C8CC01FDE(a)microsoft.com... > No :-) > > But it seems that in every document library you add contentTypes with an > attached template, the templates end up in a subdirectory that starts with > "/Forms" etc to that document library. So, for now I'm on that track. > > Next thing I want to solve :-) > > When the user saves a document to a document library, that is not created > from within SP2010, she is asked to apply one of the possible contentTypes > from a list. > > As we in our situation know which contentType we want the user to pick, we > want to remove that step for the user. > > Is there a way, via the Word object model, to set the desired contentType? > I > have not found any explicit property for that. > > Via ActiveDocument.ContentTypeProperties.SchemaXml you can get information > but it is a read-only property. > > Is it possible and what is required to manipulate the entire xml which can > be reached via ActiveDocument.WordOpenXML? > > Or is there another way? > > Thanks, > Peeter > > > "Doug Robbins - Word MVP" wrote: > >> I guess that is not the path that you are wanting to obtain? >> >> -- >> Hope this helps. >> >> Please reply to the newsgroup unless you wish to avail yourself of my >> services on a paid consulting basis. >> >> Doug Robbins - Word MVP, originally posted via msnews.microsoft.com >> >> "Mo" <Mo(a)discussions.microsoft.com> wrote in message >> news:E48F7A6E-A087-4A31-BDE5-B91D59667E47(a)microsoft.com... >> > Thanks again, >> > >> > it has a template and the path to it is >> > "http://poweredge-r210/Documents/Forms/Sida >> > brevmall/SP2010StartTemplate.dotm >> > " >> > >> > /P >> > >> > "Doug Robbins - Word MVP" wrote: >> > >> >> Does the document have a template attached to it, other than the >> >> Normal >> >> Template? >> >> >> >> What is displayed if you run a macro containing the following code on >> >> such a >> >> document? >> >> >> >> Set myTemplate = ActiveDocument.AttachedTemplate >> >> MsgBox myTemplate.Path & Application.PathSeparator _ >> >> & myTemplate.Name >> >> >> >> >> >> -- >> >> Hope this helps. >> >> >> >> Please reply to the newsgroup unless you wish to avail yourself of my >> >> services on a paid consulting basis. >> >> >> >> Doug Robbins - Word MVP, originally posted via msnews.microsoft.com >> >> >> >> "Mo" <Mo(a)discussions.microsoft.com> wrote in message >> >> news:76C40307-4491-4017-A72B-B9FC2504C53C(a)microsoft.com... >> >> > Hi and thanks, >> >> > >> >> > The document is, and could be, created from any document library in >> >> > SP2010. >> >> > There is a content type that has a .dotm as the template for that >> >> > content >> >> > type. >> >> > >> >> > When you create a new document from within SP2010, it opens up in >> >> > Word >> >> > as >> >> > "Document 1" and it doesn't yet have any name, so any .path or >> >> > .fullname >> >> > doesn't work. >> >> > >> >> > I have browsed through the xml of the document, both internally via >> >> > .WordOpenXML property and externally by examining the .zip >> >> > structure, >> >> > but >> >> > haven't found any references ther to the document library the >> >> > document >> >> > is >> >> > created from. >> >> > >> >> > Somehow there is a connection, because when you save the document, >> >> > Word >> >> > proposes the correct document library. It seems like there is an >> >> > event >> >> > handler in SP2010 that has a handle to to the document. Is there any >> >> > way >> >> > to >> >> > "take over" that handle to the newly created document? >> >> > >> >> > In Word, if you save the first created document, the one that I >> >> > don't >> >> > want, >> >> > and then save the second document - the one created via code in the >> >> > first >> >> > document, Word remembers the last save and suggests the same >> >> > document >> >> > library. But I don't want to save the first document, so that is not >> >> > an >> >> > option. >> >> > >> >> > TIA, >> >> > Peeter >> >> > >> >> > "Doug Robbins - Word MVP" wrote: >> >> > >> >> >> How is the document actually being created? From a template or by >> >> >> opening a >> >> >> document? Have you tried using the .FullName attribute of the >> >> >> attached >> >> >> template or of the file? >> >> >> >> >> >> -- >> >> >> Hope this helps. >> >> >> >> >> >> Please reply to the newsgroup unless you wish to avail yourself of >> >> >> my >> >> >> services on a paid consulting basis. >> >> >> >> >> >> Doug Robbins - Word MVP, originally posted via msnews.microsoft.com >> >> >> >> >> >> "Mo" <Mo(a)discussions.microsoft.com> wrote in message >> >> >> news:086332A8-E7E1-40D3-9273-B00FC5EB6449(a)microsoft.com... >> >> >> > Hi, >> >> >> > When creating a new Word document from a library in Sharepoint >> >> >> > and >> >> >> > then >> >> >> > saving it from Word, it suggests to save it in that same library >> >> >> > I >> >> >> > created >> >> >> > the document from. I would like to know how Word "knows" which >> >> >> > library >> >> >> > to >> >> >> > suggest? Can I find that information programatically? >> >> >> > >> >> >> > What I want to achieve is that the created document >> >> >> > programatically >> >> >> > creates >> >> >> > another new document and saves it to the same library as the >> >> >> > original >> >> >> > document was created from. And I don't intend to save the first >> >> >> > created >> >> >> > document. I know how to do this except to find the path to the >> >> >> > library. >> >> >> > >> >> >> > Any help is highly appreciated, >> >> >> > >> >> >> > Peeter >> >> >> >> >> >> . >> >> >>
From: Mo on 19 May 2010 06:16
OK, thanks anyway! /P "Doug Robbins - Word MVP" wrote: > Sorry, I do not know anything about Sharepoint, so I have cross posted this > to several of the Sharepoint newsgroups where it may be seen by someone who > can help you further. > > -- > Hope this helps. > > Please reply to the newsgroup unless you wish to avail yourself of my > services on a paid consulting basis. > > Doug Robbins - Word MVP, originally posted via msnews.microsoft.com > > "Mo" <Mo(a)discussions.microsoft.com> wrote in message > news:D6AEC356-A032-485B-9C5E-B18C8CC01FDE(a)microsoft.com... > > No :-) > > > > But it seems that in every document library you add contentTypes with an > > attached template, the templates end up in a subdirectory that starts with > > "/Forms" etc to that document library. So, for now I'm on that track. > > > > Next thing I want to solve :-) > > > > When the user saves a document to a document library, that is not created > > from within SP2010, she is asked to apply one of the possible contentTypes > > from a list. > > > > As we in our situation know which contentType we want the user to pick, we > > want to remove that step for the user. > > > > Is there a way, via the Word object model, to set the desired contentType? > > I > > have not found any explicit property for that. > > > > Via ActiveDocument.ContentTypeProperties.SchemaXml you can get information > > but it is a read-only property. > > > > Is it possible and what is required to manipulate the entire xml which can > > be reached via ActiveDocument.WordOpenXML? > > > > Or is there another way? > > > > Thanks, > > Peeter > > > > > > "Doug Robbins - Word MVP" wrote: > > > >> I guess that is not the path that you are wanting to obtain? > >> > >> -- > >> Hope this helps. > >> > >> Please reply to the newsgroup unless you wish to avail yourself of my > >> services on a paid consulting basis. > >> > >> Doug Robbins - Word MVP, originally posted via msnews.microsoft.com > >> > >> "Mo" <Mo(a)discussions.microsoft.com> wrote in message > >> news:E48F7A6E-A087-4A31-BDE5-B91D59667E47(a)microsoft.com... > >> > Thanks again, > >> > > >> > it has a template and the path to it is > >> > "http://poweredge-r210/Documents/Forms/Sida > >> > brevmall/SP2010StartTemplate.dotm > >> > " > >> > > >> > /P > >> > > >> > "Doug Robbins - Word MVP" wrote: > >> > > >> >> Does the document have a template attached to it, other than the > >> >> Normal > >> >> Template? > >> >> > >> >> What is displayed if you run a macro containing the following code on > >> >> such a > >> >> document? > >> >> > >> >> Set myTemplate = ActiveDocument.AttachedTemplate > >> >> MsgBox myTemplate.Path & Application.PathSeparator _ > >> >> & myTemplate.Name > >> >> > >> >> > >> >> -- > >> >> Hope this helps. > >> >> > >> >> Please reply to the newsgroup unless you wish to avail yourself of my > >> >> services on a paid consulting basis. > >> >> > >> >> Doug Robbins - Word MVP, originally posted via msnews.microsoft.com > >> >> > >> >> "Mo" <Mo(a)discussions.microsoft.com> wrote in message > >> >> news:76C40307-4491-4017-A72B-B9FC2504C53C(a)microsoft.com... > >> >> > Hi and thanks, > >> >> > > >> >> > The document is, and could be, created from any document library in > >> >> > SP2010. > >> >> > There is a content type that has a .dotm as the template for that > >> >> > content > >> >> > type. > >> >> > > >> >> > When you create a new document from within SP2010, it opens up in > >> >> > Word > >> >> > as > >> >> > "Document 1" and it doesn't yet have any name, so any .path or > >> >> > .fullname > >> >> > doesn't work. > >> >> > > >> >> > I have browsed through the xml of the document, both internally via > >> >> > .WordOpenXML property and externally by examining the .zip > >> >> > structure, > >> >> > but > >> >> > haven't found any references ther to the document library the > >> >> > document > >> >> > is > >> >> > created from. > >> >> > > >> >> > Somehow there is a connection, because when you save the document, > >> >> > Word > >> >> > proposes the correct document library. It seems like there is an > >> >> > event > >> >> > handler in SP2010 that has a handle to to the document. Is there any > >> >> > way > >> >> > to > >> >> > "take over" that handle to the newly created document? > >> >> > > >> >> > In Word, if you save the first created document, the one that I > >> >> > don't > >> >> > want, > >> >> > and then save the second document - the one created via code in the > >> >> > first > >> >> > document, Word remembers the last save and suggests the same > >> >> > document > >> >> > library. But I don't want to save the first document, so that is not > >> >> > an > >> >> > option. > >> >> > > >> >> > TIA, > >> >> > Peeter > >> >> > > >> >> > "Doug Robbins - Word MVP" wrote: > >> >> > > >> >> >> How is the document actually being created? From a template or by > >> >> >> opening a > >> >> >> document? Have you tried using the .FullName attribute of the > >> >> >> attached > >> >> >> template or of the file? > >> >> >> > >> >> >> -- > >> >> >> Hope this helps. > >> >> >> > >> >> >> Please reply to the newsgroup unless you wish to avail yourself of > >> >> >> my > >> >> >> services on a paid consulting basis. > >> >> >> > >> >> >> Doug Robbins - Word MVP, originally posted via msnews.microsoft.com > >> >> >> > >> >> >> "Mo" <Mo(a)discussions.microsoft.com> wrote in message > >> >> >> news:086332A8-E7E1-40D3-9273-B00FC5EB6449(a)microsoft.com... > >> >> >> > Hi, > >> >> >> > When creating a new Word document from a library in Sharepoint > >> >> >> > and > >> >> >> > then > >> >> >> > saving it from Word, it suggests to save it in that same library > >> >> >> > I > >> >> >> > created > >> >> >> > the document from. I would like to know how Word "knows" which > >> >> >> > library > >> >> >> > to > >> >> >> > suggest? Can I find that information programatically? > >> >> >> > > >> >> >> > What I want to achieve is that the created document > >> >> >> > programatically > >> >> >> > creates > >> >> >> > another new document and saves it to the same library as the > >> >> >> > original > >> >> >> > document was created from. And I don't intend to save the first > >> >> >> > created > >> >> >> > document. I know how to do this except to find the path to the > >> >> >> > library. > >> >> >> > > >> >> >> > Any help is highly appreciated, > >> >> >> > > >> >> >> > Peeter > >> >> >> > >> >> >> . > >> >> >> |