Skip to content

Word COM Automation Failure – “Call was rejected by callee” during document save and close operations. #375

@vimalv4u

Description

@vimalv4u

BulkDocumentation.json

am creating a Word document from an exported configuration folder. After some time, the script encounters an error. The template is stored in a trusted location, and the document export path is short, pointing to the C drive.

The Word document generated by the automation is saved in the Office 2007 format. However, this format is currently blocked by the organisation's File Block policies implemented through Group Policy on managed devices. Is there a way for us to export in the latest .docx format? I'm not entirely sure if this is the issue, but I thought I would share.

Failed to save file C:\IntuneManagement\<filename>.docx
Call was rejected by callee. (Exception from HRESULT: 0x80010001 (RPC_E_CALL_REJECTED))
At C:\IntuneManagement\IntuneManagement-3.10.1\Extensions\DocumentationWord.psm1:448 char:9
+         $script:doc.Close([Microsoft.Office.Interop.Word.WdSaveOptions ...
+         ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : OperationStopped: (:) [], COMException
    + FullyQualifiedErrorId : System.Runtime.InteropServices.COMException
  • Automation scripts fail to generate Word documents.
  • Residual WINWORD.EXE processes remain open after script completion.
  • Word UI intermittently displays “You cannot close Microsoft Word because a dialogue box is open.”
  • Document objects ($script:doc) become $null, causing secondary “null-valued expression” errors.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions