Search for rows in Excel via Microsoft Graph API - excel

I've built a scanner app that scans a barcode which acts as an ID. Now I need to find this item in a SharePoint Excel file using the Microsoft Graph API and perform actions with it.
Note:
The file, sheet, and table are all known beforehand.
For example, I want to retrieve row 5, with the only know parameter being Roll ID: B5
I've tried using filter methods, but they're not ideal for what I'm trying to build. I must be pushing this way over the limit as it's not a SQL database, but is there any way to get what I need?

As far as I understand the limit of microsoft-graph, the only way to perform where query is using the Filter. So far, the filter works for me.
start the session with persist = false, POST /createSession
clear filter, POST /tables/{table}/clearFilters
apply filter, -d "{ criteria: { filterOn: 'Custom', criterion: '=id' } }" POST /tables/{table}/column('{column}')/filter/apply
fetch visible row, GET /tables/{table}/range/visibleView/rows
close the session.
Hope this helps.

Related

Passing More than 1000 parameters in RESTful api

Our Dashboard have dropdown which consist of more than 8k products and we have such 4-5 dropdowns.
I want to filter data based on this dropdowns.
But if I selecting all products then restful api url is breaking.
Can i use azure bus service or similar message broker service to pass this complex and multiple parameters via service and which then consumed by all apis??
While I do understand what your need is I will suggest to re-think your approach as that will lead to a better user experience.
I will use a first drop down, completely empty, that will fill in options while the user types in whatever product list you have, that way, there is only a group of items that are filled in that the user is interested in.
I will also suggest not to load anything on that drop down until the user has entered, let's say, 5 characters.
After that let the user select an item from the dropdown, and filter the second drop down and continue to use the same technique with all drop downs you have.
Let me know if you have any questions around this approach and I will be more than happy to provide an example if you don't know how to do it.
Edit:
Including samples for load dropdown lists dynamically and also another post with an example on how to return some JSON from an Azure Function that can return the data in a dynamic way like you need.
From what I can see I think it'll be helpful for you to go through several different examples that can bring you progressive knowledge to what you need to achieve, first of all it'll be nice if you know how to load items dynamically on a dropdown list:
That is a nice example, you can have an entry where the user can type
whatever products you have and then they type, lets say, more than 5
characters go and search for that data.
https://www.codebyamir.com/blog/populate-a-select-dropdown-list-with-json
This other example shows you how to return data from an azure function
with the data that you need to show the users. This is not exactly
what you need as you need to receive a parameter with what the user
typed and search in your database for the items that match that search
and return that data in a JSON format so you can use it on your web
page to show the dropdown list. I will suggest to initially hard code
a few items and return those to check that the functionality is there
and once you have that up and running move to get the actual data from
the database.
How to return a JSON object from an Azure Function with Node.js

Error when trying to find records from SharePoint in PowerApps

I am mostly new to PowerApps but I am creating a stand-alone app that uses Power Automate to upload records to a SharePoint library. I have that working, and on one of the forms I have search functionality so that the gallery is filtered by the value in a few text boxes.
What I want to do is on the form where they upload new records, I want to look up to see if metadata already exists and eventually populate text boxes with the information from those records. Right now I am using a button with this code in the OnSelect event to just find how many records exist with that project number:
Set(varCount, CountRows(Filter(ProjectDocuments,'txtProj#'.Text, ProjNum )))
I also tried this.
If(CountRows(Filter(ProjectDocuments,'txtProj#'.Text, ProjNum )) > 0, Set(varCount, 1), Set(varCount,2))
I am getting a warning about large datasets only. However, when I try to run it nothing happens. When I look at the monitor details I get this error first:
"The query is not valid.\r\nclientRequestId: 816f2bfb-ab50-4285-b9c9-a7e03548d15f\r\nserviceRequestId: 816f2bfb-ab50-4285-b9c9-a7e03548d15f"
Then this one:
"Error when trying to retrieve data from the network"
The connection works when I am filtering a gallery, but not when I'm trying to use the count. Does anyone have any idea what is happening?
Thanks!
I'm not sure, but I suspect that there's an error in your Filter. The second argument should result in a logical true/false (include the record or not). Yours looks to resolve to a string.
Filter(ProjectDocuments,'txtProj#'.Text, ProjNum )
I think you mean
Filter(ProjectDocuments,'txtProj#'.Text = ProjNum )

LogicApp that returns newly generated ID back to original source

Hello I am trying to create a LogicApp that first:
Extracts data from CosmosDB, using a query
Loops over the results
Pushes the results data into CRM
Sidenote: Once this data is pushed into CRM, CRM automatically generates an ID for each record. How can I then:
My biggest dilemma is figuring out how can I return the newly generated ID back to the original CosmosDB container in which it was pulled from?
I have started on this and these are my questions:
Does this first part look correct in what I am doing? I must use this SQL query for this:
a. I am simply telling the Logic App to extract data from a particular container inside CosmosDB
b. Then I would like to loop over the results I just obtained, and push this to CRM
c. My dilemma is:
Once data is pushed to CRM, CRM then automatically generates an ID for each record that is uploaded. How would I then return the updated ID to cosmos?
Should I create a variable that stores the IDS, then replace the old IDs with the new ones?
I am not sure how to construct/write this logic within LogicApps and have been researching examples of this.
Any help is greatly appreciated.
Thanks
If the call to your CRM system returns the ID you are talking about then I would just add one additional action in your loop in Azure Logic App to update the read record in Azure Cosmos DB. Given that you are doing a SELECT * from the container you should have the whole original document.
Add the 'Create or update document' action as a step with a reference to the THFeature container along with your Database ID and then provide the new values for the document. I pasted an example below.
BTW. Your select query looks strange - you should avoid slow cross partition queries if you can.

SharePoint Rest call is not returning all fields

Goal: Have python program pull data from SharePoint so we can store on database.
Issue: I am able to connect to share point and return data, but I am not getting all of the fields I can see when hitting the UI page. The UI page I am hitting is in the list on REST call but is a Custom View
Update: Using the renderashtml I was at least able to see some of the data points I am looking for. I would hope there is a better solution than this
Code:
import sharepy
connection = sharepy.connect("https://{site}.sharepoint.com")
r = connection.get("https://{site}.sharepoint.com/{page}/_api/web/Lists/getbytitle('{list_name}')/items")
print(r.content)
print(r.json())
#I have also tried
https://{site}.sharepoint.com/{page}/_api/web/lists('{list_id}')/views('{view_id}')
#I was able to return data as html
https://{site}.sharepoint.com/{page}/_api/web/lists('{list_id}')/views('{view_id}')/renderashtml
Research: I have taken a look at the rest documentation for sharepoint and I am under the impression you cannot return data from a view. The solution I saw was to first hit the view and then generate a list of columns and use that to build a query to search the list. I have tied that and those fields are not available when I pull the list but are in the view.
https://social.msdn.microsoft.com/forums/sharepoint/en-US/a5815727-925b-4ac5-8a46-b0979a910ebb/query-listitems-by-view-through-rest-api
https://msdn.microsoft.com/en-us/library/office/dn531433.aspx#bk_View
Are you trying to get the data from known fields, or discover the names of the fields?
Can you get the desired data by listing the fields in a select?
_api/web/lists/getbytitle('Documents')/items?$select=Title,Created,DateOfBirth
or to get all of the fields:
_api/web/lists/getbytitle('Documents')/items?$select=*

kibana - programatically return saved search objects and associated data via REST API

I am currently working on an excel export tool for kibana using node.js. Right now I am trying to figure out if it is possible to export the data associated with a saved search within my selected kibana index.
Here is an example of what I am trying to do:
User provides authorization and selects a project within kibana that they have access to.
Once a user has selected a project, any saved searches associated with that project are populated into the UI.
The user selects a saved search, report name, and date range, and submits the form. The application then makes a request to the kibana index and returns the data associated with the selected search and within the given time range.
I have finished the authorization and UI, but I am currently stuck trying to figure out how to return the saved search objects within a specific project. I am also unsure of how to construct the request to the kibana index that would return the data associated with the selected saved search within the given time frame.
Does anyone have any experience with something similar to this? I am also very new to Elasticsearch, is this sort of functionality possible?
Answered by a wonderful Elastic team member here:
https://discuss.elastic.co/t/exporting-saved-search-data/90843

Resources