Consume custom service application in sharepoint - sharepoint

I followed this tutorial and successfully created a custom service application in my sharepoint server, my question is how to consume it from another sharepoint solution, for example I created a new empty sharepoint project and added a new application page, how I can get access to strongly type service application object from the code behind of application page?
Thanks for your help

You need to create Service Application Proxy by using SPServiceApplicationProxy. You can see the video and sample code in Creating Custom SharePoint 2010 Service Applications and Consumers.

Related

How do I update a SharePoint list via REST API in a script ran on another server for Sharepoint 2013 an also Sharepoint Online?

I need to update data in a sharepoint list remotely via a script that runs on a schedule. We currently are using sharepoint 2013 foundation but will be moving to sharepoint online in 6 months or so. I would like to know how to do this via the REST api for both 2013 on prem and online versions. Im having a hard time wrapping my head around all the different auth models, sharepoint products, available apis, frameworks etc and when reading the documentation on MSDN I cant be sure which is relevant to what version of sharepoint etc.. Anyway, so far im thinking or the 2013 on prem sharepoint I should use the High-trust certificate auth option so my script is authenticated via a certificate. Do I need to create an add-in for script to register it as an app that will talk to the rest api? The reason Im not sure is sharepoint itself never really has to call on my script and its not a webpart or page or antyhing that gets displayed on sharepoint so im a bit lost.
As for how to push data into sharepoint online lists, im assuming I would then have to register the script as a providor hosted Add-in and authenticate using OAuth2 via Azure ACS server.
Does this sound like the best way to acheive my goal? Am I on the right track or is their an eaiser option? Is there anyway I can just use a Active Directory user account in the script to make authenticated requests instead of having to create certificates trusts and create addins etc?
Update:
Heres some more info on what I'm trying to do...
The project Id like to start will be a Node or PHP script that runs on a seperate server and pulls data from a third party source, making calculations on it and then pushes the results into some Sharepoint lists. Then running this on a schedule every night to keep the Sharepoint lists up to date. I know how to do everything except getting started with Sharepoint; how to establish the connection and authentication basically.
What id like to do is access the REST apis for lists and libraries from Node or PHP which would obviously be running externally to Sharepoint. I just don't really understand how to get started. My understanding is there is Sharepoint hosted apps (client side javascript that can access the SP apis), and provider hosted apps (which is essentially an iFrame to another web app). So out of the two I'm looking at provider hosted, but do provider hosted apps only run when called? Do they need to present a front end to show in an iframe? My project only needs to push data into lists overnight. And so do I need to register the project as a provider hosted app?? Or how do I go about getting started? And then I'm lead to believe that the app model is the 2013 way of programming for Sharepoint and the new 2016/online way is Sharepoint framework (SPFX). But then the only examples I'm seeing for this is client side apps. The second project id like to do is to make a client side app which will take the data thats in the lists from project 1 and display that in certain ways dynamically using react. So I'm fairly comfortable knowing where to start for project 2, ill just straight into developing a client side react app that uses SPFX. However I'm totally stuck on starting project 1. Where do I start for project 1? What are my options?
As far as I understand your question, You need to update your on prem list from schedular and later you will update the list in your sharepoint online.
We you can create a Provider hosted app and through configuration you can switch your destination easily.
OR you can think new way to do that. You can use Node JS timer service which insert to your on prem usign rest api later the same code will work for online you just need to change the destination.
Currenlty we are also donig it with Node. Below is the simple code to create timer in nodejs.
what is does, it read the crednentials from file and email to the user.It just a simple code and can be use to insert to SP list usign rest api.
https://github.com/halfice/Node-JS-Timer-SharePoint/blob/master/app.js
furthermore It would be more clarify if you could share picture of what you want to do

How do I setup web pages within Azure Service Fabric Stateless Web API?

I am using VS 2017 and have successfully setup to use Stateless Web API. I can see the output of the default controller when I run it.
Now, I want to create web pages within this project and use AngularJS SPA within it to access its own API.
I am unable to find any examples which clearly show how to do this. Note this is ASP.NET Web API - not ASP.NET Core.
Someone please help.
I opened a support ticket with Microsoft and this can be done with the ASP.NET Web API support in service fabric. Web pages can be added to the self-hosted web api project, but each file has to be individually configured for this project - if you have hundreds of files, it does not allow you to configure the entire folder contents for the project, because you have to mark each file to build as content. The example they sent me is an obscure article in a Microsoft blog from a Microsoft Engineer nobody has heard of before.
Not worth it. Use the ASP.NET Core support.

Calling a web service from a scheduled task in Kentico 9

I am working on a scheduled task in Kentico and I need the task to call methods that exist in a separate web service. I'd like to know if it's possible or not and how to do that.
When connecting and interacting with web services there are no extraordinary steps that you have to take. There is a sample service present in CMSPages/WebService.asmx. that you can use as a reference to creating your own web service and you are free to add your own "asmx" handlers as you would to any other .NET application. Kentico is in the end a standard .NET application and you can create those without any problems.
Additionally I would recommend to using Web API 2.0 instead of the old asmx handlers. In order to see how you can create such web service you can check documentation which contains an example.

Fetching Sharepoint Groupnames and users in group using web services in MOSS 2007

I am trying to fetch all the Sharepoint groups and users in the groups using a Web service. I added web server /_vti_bin/usergroup.asmx. Then I have writen below code.
WebReference.UserGroup Group = new GetGorupNames.WebReference.UserGroup();
XmlNode Users = Group.GetGroupCollectionFromWeb();
I am unaware of further procedure.As this is my first time using web service in sharepoint. Any help provided related to xml and web service will be great.
While looking for above query I find a wonderful article which made my task easy.
Sharing with all. PSB link.
http://www.sharepointdiary.com/2013/07/export-sharepoint-users-and-groups-to-excel-using-powershell.html

External Content Type method in ECMAScript

Currently I am working on SharePoint Online (Office 365) project. I used Sandbox solution and WCF service for my project according to business requirement.
I have created an External Content Type (BCS) using WCF service as well as defined External List from it. There are some operations of WCF service which are not configured with any external list.
How can I call these operations in my visual web part using ECMAScript? Is there any other solution for the same?
Please help me I am very new to SharePoint development. Thank for your help.

Resources