How to reference a Sharepoint ContentType in field not QuickPart

M

Michael H.

Hello everyone. I am using Office 2007, Sharepoint 2007, and have set up a
Document Library with a default template, and have defined a new content type
with a handful of metadata which I want to interact with in Word docs in this
DocLib. So far, the metadata is behaving correctly between Sharepoint and new
Word docs in the library. I have a problem though, I am trying to create one
of the classic show/hide text functions via a Field, but using metadata
values to determine the conditions.

eg. Let's say I have a metadata field that I have defined, called "Workflow
Status", which is set manually (either in Sharepoint or the doc itself). I
can DISPLAY this by simply doing the usual Insert -> Quick Part -> Document
Property -> Workflow Status. What I want to do is EVALUATE "Workflow Status"
in order to show or hide some text within a field, as below:

{ IF {DocProperty "Workflow Status"} = "Draft" "Show this text for true"
"Show this text for false" }

I have tried many variations of syntax but in all cases, Word can't find
this metadata property. Is there a way to do this? Is it just syntax? Is it
actually possible, or are we restricted to display-only
QuickParts->DocProperty?

Thanks in advance
Michael
 
P

Peter Jamieson

The thing is that the properties you create in Sharepoint are not the
same type of property as "Word Custom Document Properties" and cannot be
inserted using a { DOCPROPERTY } field - when you insert them from the
Insert tab, Quick parts, document property, what is actually inserted is
a Content Control that references a piece of Custom XML that Sharepoint
has inserted into the .docx.

What you can do - this certainly works in a simple situation but I'm not
so sure what happens e.g. during a merge - is create the framework for
your IF field, e.g.

{ IF "" = "Draft" "Show this text for true"
"Show this text for false" }

then insert your Workflow Status Property between the "", using
Insert->Quick parts-> Document property.

Peter Jamieson

http://tips.pjmsn.me.uk
 
M

Michael H.

Hi Peter - and thanks! Works like a charm! Who'd have thought that you could
evaluate what appears to be a "control"! Now if only I could get these fields
to automatically update (on save, or open, or something!) Hopefully some
digging will unearth a solution to this too.

Thanks again :)
Michael
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top