Displaying Sharepoint Document Information Panel in Word addin before document has been saved to library?

Odpovědět Displaying Sharepoint Document Information Panel in Word addin before document has been saved to library?

  • 2012年5月2日 上午 02:25
     
     

    We have a bunch of new and existing Word documents that we will be saving into a Sharepoint document library, and I would like to make a Ribbon button that will intercept the save and perform some actions before and after due to requirements we have.  The addin should do the following:

    1. Provide a button to save to the Sharepoint document library

    2. Before saving the document, pop up the Document Information Panel with the proper fields for the document library (since certain fields are mandatory and I don't want the save to error out because they are not filled)

    3. Save the document to the document library

    4. After saving the document, add the Document ID from the doc library to the footer of the document, then re-save it

    I know how to accomplish steps 1 and 4 in the addin (and I'm pretty sure about 3), and I know how to make a DIP appear (with "Application.DisplayDocumentInformationPanel = true", apparently), but I don't know how to make the DIP appear with fields relevant to the Sharepoint library (some of the fields are lookups, so they need to get the info from the server). 

    Also, I'm assuming I need to do all this as a customized save process because I can't get the Doc ID until it is saved into Sharepoint, and I don't want the users to have to remember to add it in later, so I'm making a one-button solution to save into Sharepoint and then add the footer, but if anyone has any better ideas I'm open to suggestions.

    Thanks

所有回覆

  • 2012年5月5日 上午 03:16
     
     

    Well, no answers yet, but does anyone at least have any pointers to some documentation that might help?

    Thanks

  • 2012年5月5日 上午 05:36
     
     已答覆

    This can not be done using SharePoint OOTB functionality.

    You cant create your custom page to upload document with all required fields displayed.

    And when end user confirmed uploading you can create new document in your library and update its fields via SharePoint Object Model.

    You can try adding Document ID label via Information Management Policy or via your custom Event Receiver (or while uploading process on your custom page) modifying your document with OpenXML / ClosedXML or adding Reference Field to your Document.


    LinkedIn Profile

    • 已標示為解答 Shimin Huang 2012年5月11日 上午 08:16
    •  
  • 2012年5月5日 上午 05:54
     
     

    Thanks for the advice on the Information Management Policy and reference fields - I'll take a look at those and see if they help me with the footer.

    I'm not sure if you are misreading me or vice versa with your comment about creating a custom page to upload the document...  All I want to do is make the Document Information Panel that already appears in Word after attempting to save to the doc library appear *before* saving to the library.  Right now, when you save a document to the library you get an error because some of the fields in the library are required, and after the error the DIP appears so you can fill in the fields and save the document.  Is there no way to programmatically trigger that DIP to appear before saving?

  • 2012年5月5日 上午 06:32
     
     已答覆

    Hi LB42,

    Yea sry for fastreading.

    Do you have Document Information Panel for a Document Library enabled ? If not follow this:
    1.       Navigate to the Document Library for which the Document Information Panel needs to be enabled
    2.       Click on Library Settings in the Library Tools Ribbon
    3.       In the Library Settings page, click Document Content Type which is located under the Content Type Category
    4.       Click on Documents Information Panel Settings under Settings
    5.       Select the check box for “Always show Document Information Panel on document open and initial save for this conten type”

    6.       Click OK
     

    

    LinkedIn Profile

    • 已標示為解答 Shimin Huang 2012年5月11日 上午 08:16
    •  
  • 2012年5月5日 上午 07:57
     
     

    Well, that sounded really promising, but after checking that box, I still get the error "This file cannot be saved because some properties are missing or invalid" when saving a document to the library - the DIP still does not appear before it attempts to save.  Any other ideas?

  • 2012年5月5日 上午 08:17
     
     已答覆

    Ohh dear.

    I have no ideas left. As for me when i'm adding new document, MS Word Opens with Iinformation Panel visible. And there\re no problems while saving domument (MS Office 2010 & SP 2010 Enterprise).

    Maybe you have any field required by list missing on DIP (Information Panel ?

    No other ideas sry.

    

    LinkedIn Profile

    • 已標示為解答 Shimin Huang 2012年5月11日 上午 08:16
    •  
  • 2012年5月5日 上午 08:27
     
     

    Thanks for trying.  Are you adding documents by clicking on 'add document' from the library?  I think that would explain the difference - I am opening a local Word doc (or creating one) and trying to save it to the library, and getting the error.  I am deliberately trying to find a way to trigger the correct DIP without going to the doc library first, since that is the most logical flow of events for my users (user opens a Word doc from email or other source, decides it should go into the library, clicks Save As to put it there)

    As for missing fields no, the DIP shows the correct fields and works perfectly to enter those properties - it just appears after the error message instead of before.

  • 2012年5月5日 上午 09:27
     
     已答覆

    gotcha...

    Thanks for details. I've reproduced that behavior. I believe this is a way Word works and it cannot be customized via sharepoint configuration. (unless you make all field not to be required doh...)

    This can be implemented only with your custom Addin For Office or Outlook. (eg Ribbon Button + form)

    Just FYI:

    But if you need documents to be added automatically from email its easier to configure Incoming Emails support for the sharepoint library and out of the box approvals for the document to prevent some documents to be added.


    LinkedIn Profile

    • 已標示為解答 Shimin Huang 2012年5月11日 上午 08:16
    •  
  • 2012年5月5日 上午 10:02
     
     

    Thanks for giving it a good try.  Emailing the docs into sharepoint is not an option.  I only mentioned email as a potential document source.  The way Sharepoint is set up for a library with required fields, it seems to assume you will be hanging out in the document library and decide to add a document.  My users will more likely be hanging out in Word, and decide the doc they are looking at should be uploaded, so I'm trying to make the process as seamless as possible when initiated from within Word.

    You mentioned "Ribbon Button + form" - I am working on a button-based addin for this, but not sure what you are referring to by "form".  Do you mean having the ribbon button pop up a form to submit the doc to the library?  If so, how would that work to upload the current document (I have some programming experience, but very little knowledge of proper Office Addin programming)?

    Anyone else have any input on how to programmatically make the document library's DIP appear?

  • 2012年5月5日 上午 10:20
     
     已答覆 包含代碼

    Do you mean having the ribbon button pop up a form to submit the doc to the library?

    If so, how would that work to upload the current document (I have some programming experience, but very little knowledge of proper Office Addin programming)?

    yes sure

    I wish i have experience with VSTO (Visual Studio Tools for Office).

    Just found out one book on VSTO

    /me: Challenge Accepted

    As for sending document to sharepoint (from your custom form or button handler) use Client Object Model.


    LinkedIn Profile

    • 已標示為解答 Shimin Huang 2012年5月11日 上午 08:16
    •