Quantcast
Channel: All About SharePoint » vs2010
Viewing all articles
Browse latest Browse all 31

Update Metadata Field In Word Document

$
0
0

If you create a work template for a content type, you may find any updates on the content type may not reflect to the word template, e.g. new field is not shown on the Information Panel.

The solution I found is to create a dummy new document library and apply the content type. Open the document, you will find the changes and then save to word template. Upload the template to your Content type.

I also found “only 255 chars allowed” in multiple lines field. Evan I checked “Allow Unlimited Chars”. I wrote the code to update the site column (You may not need), created a dummy document library and then apply the content type;

 using (SPSite osite = new SPSite("http://chidev51:32921/SitePages/Home.aspx"))
                {
                    using (SPWeb oweb = osite.OpenWeb())
                    {
                        //SPList myList = oweb.Lists["SGM Recipe Doc"];

                        string fieldname = "Overview"; //"Instruction"; //Ingredients

                        SPField myField = oweb.Fields[fieldname];

                        ((SPFieldMultiLineText)myField).UnlimitedLengthInDocumentLibrary = true;

                        myField.Update();
                        Console.WriteLine("Done; ");
                    }
                }


Viewing all articles
Browse latest Browse all 31

Trending Articles