Update Sharepoint list view using REST web service - rest

I am developing a plugin using Java for SharePoint 2013, trying to update the list view using SharePoint REST web services, but could not find any way to go.
GetListAndView method fetches the view and field details but dont see anything to update those views.
As a work around , developing the a SharePoint solution in C# and exposing it as web service method to add, update, delete the fields in the view.
Any pointers to achieve using web services would be appreciated.
Using the MSDN help at the LINK
Tried to add/update/remove the fields using the urls as in MSDN
http:///_api/SP.AppContextSite(#target)/web/lists(guid'')/views('')/viewfields/removeviewfield('Jira_x0020_URL')?#target=''
Getting Error:
<m:error xmlns:m="http://schemas.microsoft.com/ado/2007/08/dataservices/metadata">
<m:code>-1, Microsoft.SharePoint.SPException</m:code>
<m:message xml:lang="en-US">There is no app context to execute this request.</m:message>
<m:innererror>
<m:message>There is no app context to execute this request.</m:message>
<m:type>Microsoft.SharePoint.SPException</m:type>
<m:stacktrace>
at Microsoft.SharePoint.SPAppContextSite..ctor(String siteUrl)
at Microsoft.SharePoint.ServerStub.SPAppContextSiteServerStub.InvokeConstructor(ClientValueCollection xmlargs, ProxyContext proxyContext)
at Microsoft.SharePoint.Client.ServerStub.InvokeConstructorWithMonitoredScope(ClientValueCollection args, ProxyContext proxyContext)
at Microsoft.SharePoint.Client.Rest.RestRequestProcessor.GetObjectFromPathRoot(Boolean mainRequestPath, EdmParserNode node, Boolean resourceEndpoint, MethodInformation& methodInfo)
at Microsoft.SharePoint.Client.Rest.RestRequestProcessor.GetObjectFromPath(Boolean mainRequestPath, String path, String pathForErrorMessage)
at Microsoft.SharePoint.Client.Rest.RestRequestProcessor.Process()
at Microsoft.SharePoint.Client.Rest.RestRequestProcessor.ProcessRequest()
at Microsoft.SharePoint.Client.Rest.RestService.ProcessQuery(Stream inputStream, IList`1 pendingDisposableContainer)
</m:stacktrace>
<m:internalexception>
<m:message>There is no app context to execute this request.</m:message>
<m:type>Microsoft.SharePoint.Client.ClientServiceException</m:type>
<m:stacktrace/>
</m:internalexception>
</m:innererror>
</m:error>
Looking for REST api rather than web http url get/post.

Related

How to: Get Report Definition using SSRS RESTful API?

I have been working with the RESTful SSRS endpoint documentation at https://app.swaggerhub.com/apis/microsoft-rs/SSRS/2.0 and It states that I can retrieve the Report defintiion for my reports, however I cannot find any of the endpoints to do such?
From Microsoft docs:
The REST API can also be used to provide more advanced functionality,
such as:
Navigate the folder hierarchy Discover the contents of a folder
Download a report definition
Modify default report parameters Change
or execute a refresh plan A whole lot more
The REST API is a RESTful successor to the legacy SOAP API.
Maybe I am missing something?
I am able to get the Parameter Definitions, the report by ID,
however passing in any parameters such as
https://{myreportserver}/reports/api/v2.0/reports({id})?paramter1=somevalue
does not return any definition. I am trying to get a definition return so maybe I can render the report on a web application (or at minimum provide a pdf download of the report?)
Late to the game, but in case anyone else is looking for this answer, use this URL:
https://{myreportserver}/reports/api/v2.0/reports({id})?Content/$value

Dynamics CRM Plugin or Extension

I've been following some tutorials to develop a plugin for Dynamics CRM but based on my requirements it seems like it's not what I'm looking for.
public void Execute(IServiceProvider serviceProvider)
{
//Extract the tracing service for use in debugging sandboxed plug-ins.
ITracingService tracingService =
(ITracingService)serviceProvider.GetService(typeof(ITracingService));
It seems above code provides some hooks to post events and interaction within dynamics, what area should I look under if I wanted to embed a custom HTML with content populated via XHR within the regions of Dynamics UI, let's a subsection within the lead? Also getting some contextual information Dynamics UI fields.
You are right. Plugin is for extending execution pipeline in server side transaction.
What you want is Web resource of HTML type, which you can embed in the Lead form.
SO thread to read.
GetGlobalContext function inside HTML web resource will give you the access to context & controls of Lead record (name & email) after referencing ClientGlobalContext.js.aspx. No need to pass name & email manually, though you can send them using querystring to HTML on load with setSrc.

Jira calls external REST Service

My Problem: I want to introduce a new field in JIRA with status information from external REST Service (response is json).
Plan: Every Jira issue has a input field with some reference string. Behind this field there should be a panel, what should display informations from the external REST call (parsing response JSON is required).
Can someone give me some good info pages, how to tell JIRA to call external REST Service?
If you don't want to build it see:
nFeed
HTTP Feed Custom Field
If you want to build it yourself then start by following this tutorial on Creating a custom field type which is to more or less store a basic String within the database. (This would be the reference string)
You then have two options, the first is within the JiraCustomField class override the getVelocityParameters which was taken from How to call a java method from velocity Atlassian Answers question.
Then create a method (fetchValueFromWebService(String val)) that you would call that would contain code to query the REST Service based off the fields value that would be passed in from the velocity template. (E.g. $instance.fetchValueFromWebService($value))
To perform the actual web service call you can use any library you want, just see the Managing Dependencies documentation so it gets included in the plugin. (For example using the Jira Jersey version see this)
Your other option would be to within the view-basictext.vm have it use javascript and perform an AJAX to the web service by calling a function in your own JS file and dump that into a span that you have defined: (See Including Javascript and CSS resources)
<span id="webServiceValue"></span>
<script type="text/javascript">
fetchValueFromWebService($value);
</script>
You would however need to ensure that the webservice has Cross-origin resource sharing (CORS) enabled if you go the AJAX route.

How to call SOAP service from Phonegap (iPhone app)

I am trying to call a SOAP service using this SOAP client but it is not working for me. Please help me. How can I send and receive XML SOAP with Phonegap?
Phonegap is HTML/JS/CSS commonly communicating via XHR/Ajax. It's better to use jQuery Ajax functions. You can get the details here.
Eg:
Posting-XML-SOAP-Requests
AJAX-Requests-Between-jQuery
Simple jQuery client to call a SOAP web service
If you find any cross-domain issues (or working in a browser and not working with simulator/device), please refer to the below steps.
Go to the Resources folder, you can see a file named Cordova.plist. Click on that and you can see the Root elements. Right click on the Root, add a row, set the key as ExternalHosts with type Array.
Expand the item, and add an item as item0. Give it type string and enter the value as '*'.
Don't forget to save the Cordova.plist after changes (just use cmd+s).

How to check SharePoint document permissions?

I have a custom web service deployed in SharePoint, web method of this webservice expects a SharePoint docuentUri as a parameter. As it is deployed in the SharePoint environment i am done with SharePoint authentication, but the question here is that how do i check whether the user reqesting for a perticular document is authroized or not ? In other words web service method should return some unauthorized exception if the user does not have privilege to view the document ? All i have is the SharePoint documentUri to pass as an inpurt parameter.
thanks.
Assuming your web service is deployed in the context of SharePoint in the /_vti_bin virtual directory of your SharePoint site, you can use the SharePoint object model like below to check if the calling user has specific privileges to your document. Unfortunately, the CheckPermissions call will throw an UnauthorizedException if the check fails, so it would have to be caught.
string uri = "http://localhost/Shared%20Documents/Document1.doc"; //full path to doc
using (Microsoft.SharePoint.SPSite site = new Microsoft.SharePoint.SPSite(uri))
using (Microsoft.SharePoint.SPWeb web = site.OpenWeb())
{
Microsoft.SharePoint.SPListItem item = web.GetListItem(uri);
item.CheckPermissions(Microsoft.SharePoint.SPBasePermissions.OpenItems);
}
Hope this helps,
Steve