Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 

July 7 - July 17 | Round 2 of the Power BI Dataviz World Championships. Don't miss your chance! Learn more

Reply
Anonymous
Not applicable

DataSource.Error: Web.Contents failed to get contents

Hi all,

 

I trust you are well

Can you please help?

I am trying to connect power bi to a dynamics 365 view using xrmtoolbox 

i have extracted the code but i am getting error message 

 

"DataSource.Error: Web.Contents failed to get contents"

this is my code:

 

let
GetResults = (z as text, x as number) =>
let
S = Json.Document(Web.Contents(ServiceRootURL, [RelativePath="/queueitems", Headers=[Prefer="odata.include-annotations=*"],Query=[fetchXml="
<fetch distinct=""False"" page=""" & Text.From(x) & """ paging-cookie=""" & z & """>
<entity name=""queueitem""> <all-attributes />
<filter type=""and""><condition attribute=""queueid"" operator=""eq"" uiname=""Networks with New Documents"" uitype=""queue"" value=""{5A5D9A7E-E115-EA11-A811-000D3A7ED588}"" /></filter>

<link-entity name=""inf_network"" from=""inf_networkid"" to=""objectid"" visible=""false"" link-type=""outer"" alias=""a_87fe9e109f0bea11a811000d3a86d6ba""><attribute name=""inf_customer"" /><attribute name=""inf_type"" /></link-entity>
<link-entity alias=""a_4317a47620834b68a2f9e7ca23b46f1d"" name=""task"" from=""activityid"" to=""objectid"" link-type=""outer"" visible=""false""><attribute name=""regardingobjectid"" /></link-entity>
<link-entity name=""inf_customerjourneyactivity"" from=""activityid"" to=""objectid"" visible=""false"" link-type=""outer"" alias=""a_2cc845899cf9e911a814000d3a86d716""><attribute name=""regardingobjectid"" /><attribute name=""isc_fueltype"" /><attribute name=""isc_numberoffiles"" /></link-entity>
</entity>
</fetch>"]])),
P = try Xml.Document(S[#"@Microsoft.Dynamics.CRM.fetchxmlpagingcookie"]) otherwise null,
R = if P <> null
then List.Combine({S[value],@GetResults(Text.Replace(Text.Replace(Text.Replace(Uri.Parts("http://a.b?d=" & Uri.Parts("http://a.b?d=" & P{0}[Attributes]{1}[Value])[Query][d])[Query][d], ">", "&gt;"), "<", "&lt;"), """", "&quot;"), x + 1)})
else S[value]
in
R,
ResultsList = GetResults("", 1),
ResultsTable = if List.IsEmpty(ResultsList)
then #table(
type table[ #"queueitemid"= text,
#"Entered Queue"= text,
#"Worked By (workerid)"= text,
#"Worked By"= text,
#"Type (objecttypecode)"= text,
#"Type"= text,
#"Object (objectid)"= text,
#"Object"= text,
#"Customer (inf_customer) (Object)"= text,
#"a_87fe9e109f0bea11a811000d3a86d6ba.inf_customer(Formatted Value) (Object)"= text,
#"Type (Object) (Object)"= text,
#"a_87fe9e109f0bea11a811000d3a86d6ba.inf_type(Formatted Value) (Object)"= text,
#"Regarding (regardingobjectid) (Object)"= text,
#"a_4317a47620834b68a2f9e7ca23b46f1d.regardingobjectid(Formatted Value) (Object)"= text,
#"Network (regardingobjectid) (Object)"= text,
#"a_2cc845899cf9e911a814000d3a86d716.regardingobjectid(Formatted Value) (Object)"= text,
#"Fuel Type (Object) (Object)"= text,
#"a_2cc845899cf9e911a814000d3a86d716.isc_fueltype(Formatted Value) (Object)"= text,
#"Number Of Files (Object)"= number ],{})
else #"Converted to Table",
#"Converted to Table" = Table.FromList(ResultsList, Splitter.SplitByNothing(), null, null, ExtraValues.Error),
#"Expanded Column1" = Table.ExpandRecordColumn(#"Converted to Table", "Column1",
{
"queueitemid",
"[email protected]",
"_workerid_value",
"[email protected]",
"objecttypecode",
"[email protected]",
"_objectid_value",
"[email protected]",
"a_87fe9e109f0bea11a811000d3a86d6ba.inf_customer",
"a_87fe9e109f0bea11a811000d3a86d6ba.inf_customer@OData.Community.Display.V1.FormattedValue",
"a_87fe9e109f0bea11a811000d3a86d6ba.inf_type",
"a_87fe9e109f0bea11a811000d3a86d6ba.inf_type@OData.Community.Display.V1.FormattedValue",
"a_4317a47620834b68a2f9e7ca23b46f1d.regardingobjectid",
"a_4317a47620834b68a2f9e7ca23b46f1d.regardingobjectid@OData.Community.Display.V1.FormattedValue",
"a_2cc845899cf9e911a814000d3a86d716.regardingobjectid",
"a_2cc845899cf9e911a814000d3a86d716.regardingobjectid@OData.Community.Display.V1.FormattedValue",
"a_2cc845899cf9e911a814000d3a86d716.isc_fueltype",
"a_2cc845899cf9e911a814000d3a86d716.isc_fueltype@OData.Community.Display.V1.FormattedValue",
"a_2cc845899cf9e911a814000d3a86d716.isc_numberoffiles"
},

{
"queueitemid",
"[email protected]",
"_workerid_value",
"[email protected]",
"objecttypecode",
"[email protected]",
"_objectid_value",
"[email protected]",
"a_87fe9e109f0bea11a811000d3a86d6ba.inf_customer",
"a_87fe9e109f0bea11a811000d3a86d6ba.inf_customer@OData.Community.Display.V1.FormattedValue",
"a_87fe9e109f0bea11a811000d3a86d6ba.inf_type",
"a_87fe9e109f0bea11a811000d3a86d6ba.inf_type@OData.Community.Display.V1.FormattedValue",
"a_4317a47620834b68a2f9e7ca23b46f1d.regardingobjectid",
"a_4317a47620834b68a2f9e7ca23b46f1d.regardingobjectid@OData.Community.Display.V1.FormattedValue",
"a_2cc845899cf9e911a814000d3a86d716.regardingobjectid",
"a_2cc845899cf9e911a814000d3a86d716.regardingobjectid@OData.Community.Display.V1.FormattedValue",
"a_2cc845899cf9e911a814000d3a86d716.isc_fueltype",
"a_2cc845899cf9e911a814000d3a86d716.isc_fueltype@OData.Community.Display.V1.FormattedValue",
"a_2cc845899cf9e911a814000d3a86d716.isc_numberoffiles"
}),
#"Renamed Columns" = Table.RenameColumns(#"Expanded Column1",
{
{"queueitemid", "queueitemid"},
{"[email protected]", "Entered Queue"},
{"_workerid_value", "Worked By (workerid)"},
{"[email protected]", "Worked By"},
{"objecttypecode", "Type (objecttypecode)"},
{"[email protected]", "Type"},
{"_objectid_value", "Object (objectid)"},
{"[email protected]", "Object"},
{"a_87fe9e109f0bea11a811000d3a86d6ba.inf_customer", "Customer (inf_customer) (Object)"},
{"a_87fe9e109f0bea11a811000d3a86d6ba.inf_customer@OData.Community.Display.V1.FormattedValue", "a_87fe9e109f0bea11a811000d3a86d6ba.inf_customer(Formatted Value) (Object)"},
{"a_87fe9e109f0bea11a811000d3a86d6ba.inf_type", "Type (Object) (Object)"},
{"a_87fe9e109f0bea11a811000d3a86d6ba.inf_type@OData.Community.Display.V1.FormattedValue", "a_87fe9e109f0bea11a811000d3a86d6ba.inf_type(Formatted Value) (Object)"},
{"a_4317a47620834b68a2f9e7ca23b46f1d.regardingobjectid", "Regarding (regardingobjectid) (Object)"},
{"a_4317a47620834b68a2f9e7ca23b46f1d.regardingobjectid@OData.Community.Display.V1.FormattedValue", "a_4317a47620834b68a2f9e7ca23b46f1d.regardingobjectid(Formatted Value) (Object)"},
{"a_2cc845899cf9e911a814000d3a86d716.regardingobjectid", "Network (regardingobjectid) (Object)"},
{"a_2cc845899cf9e911a814000d3a86d716.regardingobjectid@OData.Community.Display.V1.FormattedValue", "a_2cc845899cf9e911a814000d3a86d716.regardingobjectid(Formatted Value) (Object)"},
{"a_2cc845899cf9e911a814000d3a86d716.isc_fueltype", "Fuel Type (Object) (Object)"},
{"a_2cc845899cf9e911a814000d3a86d716.isc_fueltype@OData.Community.Display.V1.FormattedValue", "a_2cc845899cf9e911a814000d3a86d716.isc_fueltype(Formatted Value) (Object)"},
{"a_2cc845899cf9e911a814000d3a86d716.isc_numberoffiles", "Number Of Files (Object)"}
}),
#"Changed Type" = Table.TransformColumnTypes(#"Renamed Columns",
{
{"queueitemid", type text},
{"Entered Queue", type datetime},
{"Worked By (workerid)", type text},
{"Worked By", type text},
{"Type (objecttypecode)", type text},
{"Type", type text},
{"Object (objectid)", type text},
{"Object", type text},
{"Customer (inf_customer) (Object)", type text},
{"a_87fe9e109f0bea11a811000d3a86d6ba.inf_customer(Formatted Value) (Object)", type text},
{"Type (Object) (Object)", type text},
{"a_87fe9e109f0bea11a811000d3a86d6ba.inf_type(Formatted Value) (Object)", type text},
{"Regarding (regardingobjectid) (Object)", type text},
{"a_4317a47620834b68a2f9e7ca23b46f1d.regardingobjectid(Formatted Value) (Object)", type text},
{"Network (regardingobjectid) (Object)", type text},
{"a_2cc845899cf9e911a814000d3a86d716.regardingobjectid(Formatted Value) (Object)", type text},
{"Fuel Type (Object) (Object)", type text},
{"a_2cc845899cf9e911a814000d3a86d716.isc_fueltype(Formatted Value) (Object)", type text},
{"Number Of Files (Object)", type number}
})
,
#"Added Link" = Table.AddColumn(#"Changed Type", "Link", each Dyn365CEBaseURL & "/main.aspx?etn=queueitem&pagetype=entityrecord&id=%7b"& [queueitemid]&"%7d"),
#"Result" = if List.IsEmpty(ResultsList)
then ResultsTable
else #"Added Link"
in
#"Result"

1 REPLY 1
v-kelly-msft
Community Support
Community Support

Hi @Anonymous ,

 

Pls check if you remove the filter contents,whether you could connect to the URL?

 

Best Regards,
Kelly

Did I answer your question? Mark my reply as a solution!

Helpful resources

Announcements
FabCon and SQLCon Barcelona 2026

FabCon & SQLCon – Barcelona 2026

Join us in Barcelona for FabCon and SQLCon, the Fabric, Power BI, SQL, and AI community event. Save €200 with code FABCMTY200.

60 days of Data Days Carousel

Data Days 2026

Join Fabric Data Days 2026: 60 days of free live/on-demand sessions, challenges, study groups, and certification opportunities.

Power BI DataViz World Championships carousel

Power BI DataViz World Championships - June 2026

A new Power BI DataViz World Championship is coming this June! Don't miss out on submitting your entry.