Using Exchange.Contents with a parameter

peter789

Board Regular
Joined
Nov 20, 2016
Messages
130
In Power Query I am connecting to my Outlook account to collect data from the Calendar.
All is fine using the syntax Exchange.Contents("abc@xyz.com"). To enable this to be shared with other users I would like to enter the email address in a cell in the spreadsheet and pass it to the query. I can create a query with the email address in it but when I substitute the code above with Exchange.Contents(emailaddress) I get the dreaded Formula.Firewall error. Does anyone have any solutions or suggestions please?
 

Excel Facts

Get help while writing formula
Click the italics "fx" icon to the left of the formula bar to open the Functions Arguments dialog. Help is displayed for each argument.
I think I have solved the problem.
Initially I was attempting to refer directly to the value in the parameter:

let
Source = Excel.CurrentWorkbook(){[Name="Parameters"]}[Content],
Value = Source{0}[Value]
in
Value
...
let
Source = Exchange.Contents(Parameters),
Calendar1 = Source{[Name="Calendar"]}[Data],
etc.

This resulted in the error.

I have since tried two methods using a function to obtain the email address either from a table or a named cell. They both work fine. One I borrowed from a reply to a post made on here yesterday. (Thanks Ron Coderre)!

(ParameterName as text) =>
let
ParamSource = Excel.CurrentWorkbook(){[Name=ParameterName]}[Content],
Result = ParamSource{0}[Column1]
in
Result

...
let
Emailaddress=fnGetNamedCellVal("ParameterAddress"),
Source = Exchange.Contents(Emailaddress) as table,
etc.


Peter
 
Last edited:
Upvote 0

Forum statistics

Threads
1,223,889
Messages
6,175,224
Members
452,620
Latest member
dsubash

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top