InfoPath call web service locally - web-services

I've created a C# Class Library with common classes I'm going to use in all my forms.
I've signed the assembly and added [assembly: AllowPartiallyTrustedCallers] to AssemblyInfo.cs.
I've created a Web Reference to the List sharepoint service in order to call GetListItems since I didn't manage to call it using InfoPath's DataConnection.
Then I've added a reference to my assembly from a Form Template project from VSTA.
After I publish this form to SharePoint and then open a new form from sharepoint using infopath client the web service call works fine.
But if I try to preview the form locally by running it from VSTA I get a security exception telling me it's can't get System.Net.WebPermission.
Now, I guess it works from the published form because it accesses the same sharepoint server as the one where the form is stored.
My question is whether it's possible to also make it work when I preview it locally? It would make my development cycle much shorter (don't have to publish the form each time).
Thanks,
Michael

I found a workaround which enables me to develop and debug easily. While developing I set the form trust level to Full Trust. Before deploying to Sharepoint I change the trust level back to normal.

Related

In OTRS, how can ConfigItems be found using Webservices

I am building a website which is supposed to read ConfigItems of an OTRS system for maintenance purposes. So far I can find and use ConfigItems using the Webservice ConfigItem::ConfigItemGet and ConfigItem::ConfigItemSearch.
Sadly I am unable to find the option able to get all ConfigItems linked to a specific one. Is there an existing interface to query linked items or do I have to implement a new one?
Querys are sent from my angularjs website to a nodejs server which prepares the JSONs to interact with the OTRS 4.0.7 Rest interface. I don't need to change item in OTRS.
There is no web service available that returns the linked objects (either tickets or other CI's). It would be able to add this to Kernel/GenericInterface/Operation/ConfigItem/ConfigItemGet.pm but it's not there out of the box.

how to use addin developed with microsoft.sharepoint.dll in other system

I've developed an outlook addin in vs2013. The development machine has sharepoint installed. My code has:
using Microsoft.SharePoint;
But when I run this code on a client machine it shows an error.
enter image description here.In some sites they suggest using Microsoft.SharePoint.Client.dll. Can anyone help?
This won't work as you expected. Microsoft.SharePoint.dll is a server side library which is part of Microsoft SharePoint and hence can neither be referenced nor used otherwise in a client-side environment such as an Outlook add-in.
What you are looking for is Client-Side Object Model, or CSOM for short. However, developing CSOM apps is a completely different story, needs slightly different knowledge and skills. The bad news is most of your SharePoint-related work will have to be redeveloped almost from scratch.
If your SharePoint integration isn't heavy, you might be able to achieve what you want with SharePoint's web services, either REST or SOAP. There an article on MSDN providing insight to various types of SharePoint APIs and providing guidance which API to use in what situation. You shoudl read this first.
we can't use using Microsoft.SharePoint; in sharepoint not installed system.
we need to use using Microsoft.SharePoint.client; for client system and use client object model code.

Remotely access info path field in SharePoint 2007

I have sharepoint document library which contains infopath files, however I want to write a c# console program to read a field of infopath file, from a client machine, via sharepoint web service.
how do i do that? I am not allowed to deploy any code to sharepoint server.
Couple steps involved.
1. Get the infopath file from the Sharepoint server using webservices. You most likely will use GetListItems to find the name/URL of the file and then you can use a webclient class to stream the file.
2. Once you have the file locally (in memory) you can read any infopath using the standard XMLReader class methods.
Shouldn't be terribly complicated but does involve a few different technologies (web services, web client, XML).
One other option would be to promote the field from the form into the SharePoint library (providing it is not a field in a repeating section or a rich text field) and then use the lists web service (http://mysite/_vti_bin/lists.asmx) to find your record and read the promited fields value from the returned results in web services.
Here is a link that will hopefully help you wish the lists.asmx web service (if you need it): http://msdn.microsoft.com/en-us/library/lists.lists.getlistitems(v=office.12).aspx
Hope this helps

asp.net sharepoint development

Im my current project we need to interface with sharepoint to store and retrieve various documents.
This has previously been done by referencing the Microsoft.Sharepoint dlls directly and going from there. As I don't know a lot about sharepoint yet I have been doing some research.
Most of the examples I find actually refer to using the Sharepoint web services themselves (the various vti_bin ones shown in http://www.sharepointmonitor.com/2007/01/sharepoint-web-service/).
I cant seem to find the differences in approaches. This current project was written a few years ago so maybe the web services weren't available then?
I'm looking for a solution to add and retrieve data from sharepoint and also a little explanation as to the differences in using refernces vs the web service
Cheers
Referincing Microsoft.SharePoint.DLL is only supported on code that runs within SharePoint. It often does work on Projects that are not part of SharePoint but that are run on a SharePoint server, but that's a) unsupported and b) not all functions work. If your Applications runs outside of the SharePoint server, referencing Microsoft.SharePoint.dll won't work.
If you want to access SharePoint from an application outside of SharePoint, there's three ways:
Use the SharePoint Webservices, for example Lists.asmx
If your SharePoint site runs on SharePoint 2010, use one of the three Client Object Models (.net, Silverlight, JavaScript)
Develop some code that runs on the SharePoint Server and exposes the data through a Web Service. This only makes sense if you have to do something that's either complicated/painful to do entirely client side or if you really need full control over the web service.

web service references - dynamic URL

I am currently working on a SharePoint project that needs to use the Lists SharePoint web service (Lists.asmx). Therefore, we need to add a service reference to it in Visual Studio. However, we all develop and test on different virtual machines (with different VM names, URLs, etc.). The QA, Test and Production environments all have different names and URLs as well.
Adding a service reference adds a bunch of references to the URL that was specified when the reference was created (in the app.config. .wsdl, .disco, etc.). This is obviously a problem for us as code that works on one machine won't work anywhere else (which breaks the build and continuous integration) We also have to delete and add the service reference every time we work with code that was checked-in by someone else.
This must be a fairly common problem for people developing Web services so I wondered if there was a way around it. I know you can't really create a "dynamic" web reference, but perhaps the impacts of the URL change could be minimized somehow?
Thanks!
By default, the web-service uses the location where it was initially created. The WebService proxy has a URL property which can be set.
This example shows setting it dynamically: http://www.codeproject.com/KB/XML/wsdldynamicurl.aspx
EDIT:
You're also not limited to using the Add Web Reference feature in Visual Studio. You can use the wsdl.exe tool that ships with the .NET Framework SDK to generate the code file.