Forum Discussion
Approval Status odata_ModerationStatus is only Approved
Hello,
I am connecting to a Sharepoint library where the documents have to be approved so there is an Approval Status column. I can find in PowerBI the odata_ModerationStatus but the values are only Approved, when there are documents that have Pending as a status.
I can't seem to find any other field that has the current status of the document.
Can anyone point me in the reight direction?
Thanks
Hi Rosie
When connecting to a SharePoint library in Power BI, the
odata_ModerationStatus field should indeed show all the moderation statuses, including "Pending," "Approved," "Rejected," etc. However, if you're seeing only "Approved" statuses, it could be due to a few potential issues with either the data loading or the permissions/access setup.Here are some steps and possible solutions you can try:
1. Check Permissions:
Make sure that the account used to connect Power BI to the SharePoint library has sufficient permissions to see the document approval statuses. Sometimes, limited permissions may restrict visibility to only "Approved" documents.
2. Use the SharePoint API:
You may not be seeing all the relevant metadata fields because Power BI's default connection might not expose them correctly. You can directly query SharePoint using the SharePoint API to retrieve more comprehensive data, including approval statuses. Here’s how you can do it:
-
Use the following SharePoint API query in Power BI (via the OData feed):
plaintexthttps://[Your_SharePoint_Site]/_vti_bin/ListData.svc/[Your_Library_Name] -
In this case, check if
Approval Status (or other relevant fields) are properly populated and exposed by the API. You might find additional metadata fields not exposed by Power BI’s default connector.3. Check for Alternate Columns:
SharePoint sometimes has multiple columns that can indicate approval status. You might want to explore the following columns in your SharePoint list:
Status: Sometimes SharePoint libraries have a field calledStatus or a variation that reflects the approval process.Approval Comments orApproval Status: Depending on your SharePoint setup, there could be other custom fields tracking approval steps.Versioning: Ensure that versioning is not impacting the visibility of the approval status in Power BI.4. Try Refreshing the Data Model:
If you have recently updated documents in SharePoint or changed their statuses, and Power BI is still showing outdated statuses, try refreshing your data model. Sometimes Power BI's cached data might not reflect the latest changes in SharePoint.
5. Check for Custom Views or Filters:
Ensure that your SharePoint library view doesn’t have filters applied that could restrict the documents you're seeing in Power BI to only "Approved" statuses. Ensure you're pulling data from a view that shows all documents, regardless of status.
6. Custom Field Mappings:
If you are using custom workflows or SharePoint Designer workflows, it is possible that the approval status is stored in a custom field that is not automatically exposed in Power BI. You may need to identify that custom field and make sure it is selected when importing the data.
Example of Dynamic Query to Extract Status:
Here’s how you can use Power Query to dynamically extract and analyze the Approval Status:
Mlet Source = OData.Feed("https://[Your_SharePoint_Site]/_vti_bin/ListData.svc/[Your_Library_Name]"), FilteredRows = Table.SelectRows(Source, each [ModerationStatus] <> null) in FilteredRowsThis query dynamically extracts rows where the
ModerationStatus is available and can help you identify all possible approval statuses.If none of these solutions help, I would also consult the SharePoint forum:
https://techcommunity.microsoft.com/t5/sharepoint/bd-p/SharePoint_General
If my answer was helpful please give me a Kudos and accept as a Solution.
-
3 Replies
- Ritaf1983Super User
Hi Rosie
When connecting to a SharePoint library in Power BI, the
odata_ModerationStatus field should indeed show all the moderation statuses, including "Pending," "Approved," "Rejected," etc. However, if you're seeing only "Approved" statuses, it could be due to a few potential issues with either the data loading or the permissions/access setup.Here are some steps and possible solutions you can try:
1. Check Permissions:
Make sure that the account used to connect Power BI to the SharePoint library has sufficient permissions to see the document approval statuses. Sometimes, limited permissions may restrict visibility to only "Approved" documents.
2. Use the SharePoint API:
You may not be seeing all the relevant metadata fields because Power BI's default connection might not expose them correctly. You can directly query SharePoint using the SharePoint API to retrieve more comprehensive data, including approval statuses. Here’s how you can do it:
-
Use the following SharePoint API query in Power BI (via the OData feed):
plaintexthttps://[Your_SharePoint_Site]/_vti_bin/ListData.svc/[Your_Library_Name] -
In this case, check if
Approval Status (or other relevant fields) are properly populated and exposed by the API. You might find additional metadata fields not exposed by Power BI’s default connector.3. Check for Alternate Columns:
SharePoint sometimes has multiple columns that can indicate approval status. You might want to explore the following columns in your SharePoint list:
Status: Sometimes SharePoint libraries have a field calledStatus or a variation that reflects the approval process.Approval Comments orApproval Status: Depending on your SharePoint setup, there could be other custom fields tracking approval steps.Versioning: Ensure that versioning is not impacting the visibility of the approval status in Power BI.4. Try Refreshing the Data Model:
If you have recently updated documents in SharePoint or changed their statuses, and Power BI is still showing outdated statuses, try refreshing your data model. Sometimes Power BI's cached data might not reflect the latest changes in SharePoint.
5. Check for Custom Views or Filters:
Ensure that your SharePoint library view doesn’t have filters applied that could restrict the documents you're seeing in Power BI to only "Approved" statuses. Ensure you're pulling data from a view that shows all documents, regardless of status.
6. Custom Field Mappings:
If you are using custom workflows or SharePoint Designer workflows, it is possible that the approval status is stored in a custom field that is not automatically exposed in Power BI. You may need to identify that custom field and make sure it is selected when importing the data.
Example of Dynamic Query to Extract Status:
Here’s how you can use Power Query to dynamically extract and analyze the Approval Status:
Mlet Source = OData.Feed("https://[Your_SharePoint_Site]/_vti_bin/ListData.svc/[Your_Library_Name]"), FilteredRows = Table.SelectRows(Source, each [ModerationStatus] <> null) in FilteredRowsThis query dynamically extracts rows where the
ModerationStatus is available and can help you identify all possible approval statuses.If none of these solutions help, I would also consult the SharePoint forum:
https://techcommunity.microsoft.com/t5/sharepoint/bd-p/SharePoint_General
If my answer was helpful please give me a Kudos and accept as a Solution.
-
- AnonymousNot applicable
Hi Rosie , Ritaf1983, thank you for your prompt reply!
Per my test, I could not reproduce your issue, please check if you could get the right status via following connection:
After connecting to the site, choose the related library you need, my test result for your reference:
Best regards,
Joyce
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.