1

I have created a SharePoint library with some custom columns (Request, Response etc..), I go to library settings -> Advanced settings-> Clicked on Edit template link -> saved the word template with .docx. Then I can see all the custom columns in document information panel.

Looks like the following word document.

enter image description here

When I go to File-> Properties-.Advanced Properties -> I can only see these three properties.

enter image description here

    public static string WDGetCustomProperty(
  string fileName, string propertyName)
    {
        string returnValue = null;

        using (var document = WordprocessingDocument.Open(fileName, false))
        {
            var customProps = document.CustomFilePropertiesPart;
            if (customProps != null)
            {
                // No custom properties? Nothing to return, in that case.
                var props = customProps.Properties;
                if (props != null)
                {


                    var prop = props.
                      Where(p => ((CustomDocumentProperty)p).
                        Name.Value == propertyName).FirstOrDefault();
                    // Does the property exist? If so, get the return value.
                    if (prop != null)
                    {
                        returnValue = prop.InnerText;
                    }
                }
            }
        }
        return returnValue;
    }

By using the above code I can only retrieve these 3 properties (Mentioned in above image). I can retrieve built in property values like Author, last modified by but I was not able to retrieve the custom property values. Please reply as soon as possible.

Your Answer

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

Browse other questions tagged or ask your own question.