cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Highlighted
Frequent Visitor

Word Online Connector (Object reference not set to an instance of an object)

Hello,

I'm trying to create a Word File by using the "Populate a Microsoft Word Template" action from Word Online (Business) Connector. After sucessfuly creating the template and making it recognizable by the Flow action, I tested it and received the following error: 

Object reference not set to an instance of an object
I've tried making the template file reside both in OneDrive for Business and Sharepoint Online, but had no success.
 
I'm populating the fields of the Word Doc using a Sharepoint List with the trigger "When a new item is created". Bellow is a screenshot of the Flow and the Error.

Flow.PNG

 

Error1.PNG

 

Error code says:

{
"error": {
"code": 500,
"source": "flow-apim-msmanaged-na-northcentralus-01.azure-apim.net",
"clientRequestId": "df34166a-2586-4d34-bf47-0de5794ab8d2",
"message": "BadGateway",
"innerError": {
"status": 500,
"message": "Object reference not set to an instance of an object.\r\nclientRequestId: df34166a-2586-4d34-bf47-0de5794ab8d2",
"source": "wordonlinebusiness-eus.azconn-eus-01.p.azurewebsites.net"
}
}
}
Any Ideas?

Best Regards,

Pedro

 

1 ACCEPTED SOLUTION

Accepted Solutions
Highlighted
Frequent Visitor

Re: Word Online Connector (Object reference not set to an instance of an object)

@NickDewitt thank you! Your solution worked perfectly. Just adding a little bit for clarification: you must still save the document as a .docx document, not as an .docm (Macro-enabled document).

View solution in original post

8 REPLIES 8
Highlighted
Resolver II
Resolver II

Re: Word Online Connector (Object reference not set to an instance of an object)

@Gaiarsa,

 

I wrote a blog overview of the Word Online connectors. Check it out here: https://www.dmcinfo.com/latest-thinking/blog/id/9838/overview-of-microsoft-flows-new-word-online-con...

 

Please give kudos and mark as the solution if it works!

Thanks,


Dan

Highlighted
Frequent Visitor

Re: Word Online Connector (Object reference not set to an instance of an object)

Hi @danmitchell36 ,

Unfortunately, your link is down for me. I can't seem to access it.

 

Edit: I have followed exactly the steps you outlined and it still does not work. Do you have any other tips?



Best Regards,


Pedro

Highlighted
Advocate II
Advocate II

Re: Word Online Connector (Object reference not set to an instance of an object)

@Dana I don't think you actually read his question, as your blog mentions nothing about the issue he is having.

 

We are also having the same issue with a word document, flow refuses to process the document template with an internal error of "Object reference not set to an instance of an object".

 

+1 to OP for a well written example of the problem.

Highlighted
New Member

Re: Word Online Connector (Object reference not set to an instance of an object)

@NickDewitt  I think you were not talking to me as I have not posted anything.  Could you have perhaps been talking to 'Dan' ?

Highlighted
Advocate II
Advocate II

Re: Word Online Connector (Object reference not set to an instance of an object)

Ah yeah sorry @Dana it offered @danmitchell36 and autocompleted to you!

Highlighted
Resolver II
Resolver II

Re: Word Online Connector (Object reference not set to an instance of an object)

@NickDewitt,

 

I have used the Microsoft Word connectors on a number of projects and have never seen that issue before. While my post didn't address his issue directly I hoped that if he followed the instructions in the blog post he would be able to resolve the issue. 

 

Highlighted
Advocate II
Advocate II

Re: Word Online Connector (Object reference not set to an instance of an object)

@Gaiarsa I managed to fix this problem by deleting and re-inserting all content controls as plain-text (you can only utilise plain-text, combo and dropdown with this connector currently).

 

The document I am working on came from a 3rd party courier with a lot of content controls already inserted, we want to populate this document with data that we have in sharepoint etc.

 

Rather than manually removing and re-inserting all of the content controls, I wrote some vba to do it for me. Insert that into a module in the word vba editor and run it (F5), and you should no longer get this error. This obviously means the error was related to one or more of the content controls that were inserted (although I had already forced all to plain text before re-inserting and that didnt fix it).

 

 

Sub CleanseControls()

    Dim existingControls As New Collection
    Dim cc As ContentControl
    Dim newcc As ContentControl
    
    For Each cc In ActiveDocument.ContentControls
        existingControls.Add cc
    Next cc
    
    For Each cc In existingControls
Dim tag As String: tag = cc.tag Dim title As String: title = cc.title cc.Range.Select cc.Delete Set newcc = ActiveDocument.ContentControls.Add(wdContentControlText) newcc.title = title newcc.tag = tag
Next cc End Sub

 

Highlighted
Frequent Visitor

Re: Word Online Connector (Object reference not set to an instance of an object)

@NickDewitt thank you! Your solution worked perfectly. Just adding a little bit for clarification: you must still save the document as a .docx document, not as an .docm (Macro-enabled document).

View solution in original post

Helpful resources

Announcements
Community Conference

Power Platform Community Conference

Check out the on demand sessions that are available now!

Power Platform ISV Studio

Power Platform ISV Studio

ISV Studio is designed to become the go-to Power Platform destination for ISV’s to monitor & manage published applications.

Tech Marathon

Maratón de Soluciones de Negocio Microsoft

Una semana de contenido con +100 sesiones educativas, consultorios, +10 workshops Premium, Hackaton, EXPO, Networking Hall y mucho más!

Top Solution Authors
Top Kudoed Authors
Users online (5,547)