none
The open method or property is not available because permission for this document is currently restricted RRS feed

  • Question

  • Hi All,

    Make sure you are on Vista or Windows 7. And Turn on the preview pane. And preview a word 2007 document.

    I write a add-in using C#. And do the following workflows.

    1. close the current documents.[Call close API]

    2.Open the closed document again[Call Open API]

    3.It will throw an exception -  "The open method or property is not available because permission for this document is currently restricted"

     

    Do you know the reason. And any workaround?

     

    Ryan

     

    Monday, January 17, 2011 3:37 AM

Answers

All replies

  • Hello Ryan,

    Thanks for posting. What do you mean turning on the Preview Pane? Go to Review tab->Tracking group->Reviewing pane?

    What kind is this add-in? VSTO add-in or Shared add-in?

    To reproduce this issue on my side, would you mind sharing a simple project with us? So we could use it to do further research. Have a nice day.

     


    Bessie Zhao [MSFT]
    MSDN Community Support | Feedback to us
    Get or Request Code Sample from Microsoft
    Please remember to mark the replies as answers if they help and unmark them if they provide no help.

    Monday, January 17, 2011 6:19 AM
  • Thanks for your reply.

     

    I want to create a word process, but don't share to other.

    eg:

    1.Microsoft.Office.Interop.Word.Application wordApp = new Microsoft.Office.Interop.Word.Application(); There is a word process - 'WINWORD.EXE' in task manager.

    2.Launch word 2007, the word no longer create a new process called 'WINWORD.EXE'.

     

    But I don't want to share my word process to other word application. And only use in my application. So is there a way to create word process only use for my application?

    Ryan

     

    Monday, January 17, 2011 7:11 AM
  • Hi Ryan

    See if the approach outlined in this KB article helps

    http://support.microsoft.com/kb/188546/


    Cindy Meister, VSTO/Word MVP
    • Marked as answer by Bessie Zhao Monday, January 24, 2011 10:34 AM
    Monday, January 17, 2011 10:04 AM
    Moderator
  • Please see the following codes:

    //Word 2007 preview handler
    Guid guid = new Guid("84f66100-ff7c-4fb4-b0c0-02cd7fb668fe");
    Type type = Type.GetTypeFromCLSID(guid, true);
    object instance = Activator.CreateInstance(type);
    
    IInitializeWithFile fileInit = instance as IInitializeWithFile;
    if (fileInit != null)
    {
      fileInit.Initialize(fullName,0);
    }
    

    I only want to create exclusive word 2007 process. Not use for others.

    Is this possible? If yes, could you give me a sample?

    Ryan

    Tuesday, January 18, 2011 3:01 AM
  • Hello Ryan,

    Have you tried the KB article Cindy provided above to work around this issue? For the code sample, please refer to this thread: http://social.msdn.microsoft.com/Forums/en-US/vsto/thread/2dc7b95e-8197-4ea4-8d31-ae7f61a182da/.

    If this post does not help, just feel free to follow up. Have a nice day.


    Bessie Zhao [MSFT]
    MSDN Community Support | Feedback to us
    Get or Request Code Sample from Microsoft
    Please remember to mark the replies as answers if they help and unmark them if they provide no help.

    Thursday, January 20, 2011 9:19 AM
  • ryan, if there is any way you can complete your function without "preview pan" on, the error will disappear. When preview pane is active, it can interfere with other processes trying to access a file.
    Sunday, August 21, 2011 2:10 PM