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

Calling all Data Engineers! Fabric Data Engineer (Exam DP-700) live sessions are back! Starting October 16th. Sign up.

Reply
Anonymous
Not applicable

power bi create schedule refresh api not able to set email ID

 

Hi Team,

I am trying to programmatically create schedule refresh in each dataset,I am using refreshschedule api to achieve same
https://docs.microsoft.com/en-us/rest/api/power-bi/datasets/updaterefreshschedule 

It is able to create refresh schedule but no option to provide email id  , In Power bi ui I have option to tick email id instead of dataset owner and provide email id , but from api only 2 options available are NoNotification or MailOnFailure. Where I can provide email id ?

 

Regards,

Neha Oberoi

2 REPLIES 2
v-jingzhang
Community Support
Community Support

Hi @Anonymous 

Currently there is no option to set the email id to receive email notifications via REST API. You could vote for below idea about this feature: Microsoft Idea · Email Notification for Many Users, for Failed Dataset Refresh via REST API (powerbi.com) 

 

When you set notifyOption is MailOnFailure, it will send email notifications to dataset owner by default. However, if you add additional recipients in the Email these users when the refresh fails textbox in Power BI UI, these users can receive email notifications if a dataset refresh fails when triggered via API.

 

Regards,
Community Support Team _ Jing Zhang

 

Hi, 

I've tried below code, if I set MailOnFailure it fails and when I set NoNotification it passes. I want to send notification to owner.

 

$ScheduleJsonEnable = '{
"value":
{
"enabled":true,
"notifyOption":"MailOnFailure",
"days":["Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday"],
"times":["00:00","01:00","02:00","03:00","04:00","05:00","06:00","07:00","08:00","09:00","10:00","11:00","12:00","13:00","14:00","15:00","16:00","17:00","18:00","19:00","20:00","21:00","22:00","23:00"],
"localTimeZoneId":"UTC"
}
}'

Invoke-PowerBIRestMethod -Method Patch -Url groups/$($Workspace.Id.Guid)/datasets/$($Report.DatasetId)/refreshSchedule -Body $ScheduleJsonEnable

 

 

Error:

Invoke-PowerBIRestMethod : One or more errors occurred.
At line:1 char:1
+ Invoke-PowerBIRestMethod -Method Patch -Url groups/$($Workspace.Id.Gu ...
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : WriteError: (Microsoft.Power...werBIRestMethod:InvokePowerBIRestMethod) [Invoke-PowerBIRestMethod], AggregateException
+ FullyQualifiedErrorId : One or more errors occurred.,Microsoft.PowerBI.Commands.Profile.InvokePowerBIRestMethod

 

>>

Resolve-PowerBIError -Last


HistoryId: 9


Message : Response status code does not indicate success: 400 (Bad Request).
StackTrace : at System.Net.Http.HttpResponseMessage.EnsureSuccessStatusCode()
at Microsoft.PowerBI.Commands.Profile.InvokePowerBIRestMethod.<InvokeRestMethod>d__35.MoveNext()
Exception : System.Net.Http.HttpRequestException
InvocationInfo : {Invoke-PowerBIRestMethod}
Line : Invoke-PowerBIRestMethod -Method Patch -Url groups/$($Workspace.Id.Guid)/datasets/$($Report.DatasetId)/refreshSchedule -Body $ScheduleJsonEnable

Position : At line:1 char:1
+ Invoke-PowerBIRestMethod -Method Patch -Url groups/$($Workspace.Id.Gu ...
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
HistoryId : 9

Helpful resources

Announcements
FabCon Global Hackathon Carousel

FabCon Global Hackathon

Join the Fabric FabCon Global Hackathon—running virtually through Nov 3. Open to all skill levels. $10,000 in prizes!

October Power BI Update Carousel

Power BI Monthly Update - October 2025

Check out the October 2025 Power BI update to learn about new features.

FabCon Atlanta 2026 carousel

FabCon Atlanta 2026

Join us at FabCon Atlanta, March 16-20, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.

Top Solution Authors
Top Kudoed Authors