Data connection with SharePoint list - sharepoint

I am new to foundry and I am trying to set up a data connection to a SharePoint list. I know SharePoint supports REST APIs but that is about the extent of what I know. The Foundry Data connection documentation wasn't as helpful as I had hoped.
How would I go about this? Thank you!
I think something along the lines of this:
GET https://{site_url}/_api/web/lists/GetByTitle('Test')/items Authorization: "Bearer " + accessToken Accept: "application/json;odata=verbose"
I want to pull all the items from the list into a dataset and then as a new item is added have foundry grab it and put it in the dataset. I hope this is the clarification you were looking for.

Related

createNewDiscussion/createNewDiscussionReply via JSOM in SharePoint Discussion Board from external Angular SPA

Scenario:
I have an Angular SPA and a SharePoint 2013, installed in separated servers. I would like to consume a SharePoint discussion board in my SPA, means I would like to use my customized UI to perform CRU(D) operations on the SharePoint discussion board.
Through some workarounds I already achieved this objective using the SP REST API, but unfortunately since REST API doesn't allow setting some parameters for the discussion board (in particular the ParentID) I am not really able to use REST API in a satisfactory way.
In order to make it possible to work through the REST API I had to change the configuration in the IIS of the SharePoint Server to rewrite the headers and allow the Cross-Domains Call. Moreover I pass as options in the http call the digest from the context info. As I said, the comunication works, I can create new discussions or replies, but these are malformed because the API itself doesn't offer the methods that I need, but just some workaround to post not-so-good-looking messages in the discussion board (for example the threading is completely lost).
With JSOM I am doing this (I simpliefied a bit):
createReply() {
let clientContext = new SP.ClientContext("otherserver.sharepoint.com");
    let list = clientContext.get_web().get_lists().getByTitle("myDiscussionBoardName");
    let discussionItem = list.getItemById(parentTopicId); //eg. parentTopicId === 10
    let properties = {'Body': 'My Message'};
    let messageItem = SP.Utilities.Utility.createNewDiscussionReply(clientContext, discussionItem);
    for (var propName in properties) {
messageItem.set_item(propName, properties[propName])
    }
messageItem.update();
    clientContext.executeQueryAsync(() => 
{ console.log("Gotcha!", messageItem); },
  (error: any) => { console.log('Request failed', error); });
  }
But unfortunately I get a 401 error. My understanding would also be that I won't need to provide a digest, since JSOM should take care of it by itself, but I am not sure of this, nor I am aware of how I could provide the digest within a JSOM call.
Honestly this message is my last hope to get to the bottom of this. I actually am already planning to use different solutions, but I can't believe that a solution doesn't exist, in particular because using a local proxy (sp-rest-proxy, you may know it well if you develop angular application based on SP) the connection somehow works correctly.
check the below link and also I just put one the example from our code
http://sharepointsanjay.blogspot.com/2016/05/how-to-refresh-request-digest-token.html
var headers = {
"Accept": "application/json; odata=verbose",
"Content-Type": "application/json; odata=verbose",
"X-RequestDigest": document.getElementById("__REQUESTDIGEST").value,
"X-HTTP-Method": "MERGE",
"If-Match": "*"
};
return $http({
headers: headers,
method: "POST",
url: url,
data: JSON.stringify(data)
}).then(complete, failed);

Edit Data of Easytable Azure

Is there anyway to modify the data in Easytable Azure?
For example, I want to change the text for the first row to "testing 23/2". How to do that? Besides, I want to changed the deleted from true to false. Any idea how to do that?
As far as I know, if you want to use easy table, you must connect to a database.
So if you want to change the data inside the easy table, you could find the table in the azure sql database and modify it.
You could find your database in the data connection tag.
Besides, I suggest you could install an MMSE and use it connect to your azure sql database, then you could modifty it by using MMSE.
More details ,you could refer to follow link and query:
Link:
https://learn.microsoft.com/en-us/azure/sql-database/sql-database-connect-query-ssms
Steps:
1.connect to azure sql database
2.Select the table and edit it
Besides, I suggest you could also use send patch method by Restful API to update the row data.
Update:
Here is the execute image:
Result:
Besides, as I says you could use zumo-api to send request to the easy table to change the table’s result.
At first ,I suggest you could check the easy table’s permission.
You need set the update is allow anonymous access.
Then you could use fiddler to send the request.
Method:PATCH
URL: http://YOURSSITENAMEHERE.azurewebsites.net/Tables/text/YOURROW’SID
Head:
Accept: application/json
Content-Type: application/json
Content-Length: 32
ZUMO-API-VERSION: 2.0.0
Host: YOURSSITENAMEHERE.azurewebsites.net
Content:
{"text":"bbbl","complete":false}
Yours maybe {"TEXT":"bbbl","COMPLETE":false}
Like below image shows:
Result:

Creating new task through WebHook with Asana API

I am working with a form system very similar to WUFOO that allows me to send data to an external website using WebHooks.
I have been able to connect my form to my ASANA system through Zapier but I cannot seem to get the API system to operate correctly. Can someone please advise or assist me on what I am doing incorrectly here?
In the screenshot note the following:
- Web URL functions for any web URL (https or http)
- HTTP method has POST, PUT, or GET options
- Data format allows me to input virtually anything so I can match up form fields with any necessary names for ASANA.
I simply cannot get the system to connect to ASANA. Please help me.
Screen shot of WebHook Options
I don't have access to your exact form builder but assuming it does what it says it is doing you can try the following. I'll use creating a task as an example.
Create a personal access token in Asana. To do this log in to Asana, click the icon in the top right corner and open "My profile settings". Go to the apps tab and create a personal access token. You will only ever see this token once so create a new one if you lose it. Also retrieve your workspace id, you can get it by opening app.asana.com/api/1.0/workspaces while logged in.
Now back to your form. For the website url place the specific endpoint you want to hit at Asana. For example, lets create a new task:
https://app.asana.com/api/1.0/tasks
Under the HTTP Method you want to select POST
Under the HTTP Headers you want to specify something like (replace 0/1234abcd with your access token):
{
"Authorization": "Bearer 0/1234abcd",
"Content-Type": "application/json"
}
You can use Send Raw Data and specify something like the following in the raw data section (replace 1234 with your workspace id):
{
"data": {
"workspace": 1234,
"name": "The name of the task"
}
}
You can of course add other fields- please see the API reference for more information:
https://asana.com/developers/api-reference/tasks
Let me know if that works for you.

Fetch data from multiple list sharepoint REST API in one Ajax call

How can we get data from multiple list by using sharepoint REST API in one call . I: want to get data and also want to use multiple list for searching data too. Is it possible to do this in one call if "YES" then how and if "NO" then what are the best solutions for getting data??
Thanks in advance..
First of all, SharePoint REST does not support request batching like CSOM does. That makes it impossible to make multiple REST calls in a single round trip to the service.
The good news that according to Office 365 business roadmap the feature:
CSOM Batching for Apps for SharePoint
This feature allows support for $batch requests in SharePoint's OData
REST services. This allows apps to make multiple REST calls in a
single round trip to the service.
is already in Development state. Hurray! Thanks to the Office Developer Platform UserVoice for that and specifically to Andrew Connell for creating a feature request
From another hand, Search Query API could be used for querying multiple lists, for example the following search query:
contentclass:STS_ListItem AND ContentType:Task
will return all Task items.
JavaScript Example
The following example demonstrates how to utilize Search API using REST endpoint:
function searchTaskItems(webUrl,success, failure) {
var url = webUrl + "/_api/search/query?querytext='contentclass:STS_ListItem AND ContentType:Task'";
$.ajax({
url: url,
method: "GET",
headers: { "Accept": "application/json; odata=verbose" },
success: function (data) {
success(data.d.query);
},
error: function (data) {
failure(data);
}
});
}
//print tasks
searchTaskItems(_spPageContextInfo.webAbsoluteUrl,
function(query){
var resultsCount = query.PrimaryQueryResult.RelevantResults.RowCount;
for(var i = 0; i < resultsCount;i++) {
var row = query.PrimaryQueryResult.RelevantResults.Table.Rows.results[i];
var taskName = row.Cells.results[3].Value;
console.log(taskName);
}
},
function(error){
console.log(JSON.stringify(error));
}
);
no, you will need multiple REST calls to achieve that.
You can use CSOM as well, to decrease number of round trips to the server. You can load your entire query client side and only execute one query to the server to join all the lists.
You can retrive data from multiple list using REST. All you could is to retrieve data from multiple list if there's any Lookup column that will link data between/among the lists. In such scenario, you will need to use the $expand clause.
Search in google for expand sharepoint Rest call, that may work for you.

Updating a wiki page with the REST API

How do you update a SharePoint 2013 wiki page using the REST API?
Three permutations:
Reading an existing page (content only)
Updating an existing page
Creating a new page
For reading an existing page, of course I can just to a "GET" of the correct URL, but this also brings down all the various decorations around the actual data on the wiki page-- rather than fish that out myself, it would be better if there was a way to just get the content if that is possible.
Are there special endpoints is the REST API that allow for any of these three operations on wiki pages?
As stated in GMasucci's post, there does not appear to be a clean or obvious way of instantiating pages through the REST API.
You can call the AddWikiPage method from the SOAP service at http://[site]/_vti_bin/Lists.asmx. This is an out of the box service that will be accessible unless it has been specifically locked down for whatever reason.
To read the content of a wiki page through the REST API, you can use the following endpoint:
https://[siteurl]/_vti_bin/client.svc/Web/GetFileByServerRelativeUrl('/page/to/wikipage.aspx')/ListItemAllFields
The content is contained within the WikiContent field. You may want to add a select to that URL and return it as JSON to reduce the amount of data getting passed over if that is a concern.
As for updating the content of an existing wiki page, it is not something I have tried but I would imagine it's just like populating another field through the REST API. This is how I would expect to do it:
Do a HTTP POST to the same endpoint as above
Use the following HTTP headers:
Cookie = "yourauthcookie"
Content-Type = "application/json;odata=verbose"
X-RequestDigest = "yourformdigest"
X-HTTP-Method, "MERGE"
If-Match = "etag value from entry node, returned from a GET to the above endpoint"
Post the following JSON body
{
"__metadata": { "type": "SP.Data.SitePagesItem" },
"WikiField" : "HTML entity coded wiki content goes here"
}
The interim answer I have found is to not utilise REST, as it appears to not be
fully documented
fully featured
supported across Sharepoint 2013 and On-line in the same way
So my current recommendation would be to utilise the SOAP services to achieve the same, as these are more documented and easily accessible.

Resources