Access SharePoint objects from Delphi - sharepoint

We need to read and write the objects in SharePoint, such as the appointments (events) in SharePoint, from Delphi, what's the best/easiest way to do it? Any advises are appreciated! Thank you.

If you are able to use .NET references in Delphi and can develop on a SharePoint server then use the SharePoint Object Model. This is the most powerful way of working with SharePoint. Add a reference to C:\Program Files\Common Files\Microsoft Shared\Web Server Extensions\12\ISAPI\Microsoft.SharePoint.dll. The object model has its pain points to be aware of however and can have a bit of a steep learning curve in some areas. Take note of the need to dispose of partially unmanaged objects such as SPSite and SPWeb if you take this route.
Alternatively use the SharePoint web services. These are quite simple and work well once you get their syntax correct. If your code cannot be deployed to the SharePoint server then they are your only option. The downside is that they are significantly reduced in functionality compared to the object model. You will certainly run up against this sooner or later which is why I recommend starting with the object model if possible.

The usual way is to refer to the MSDN documentation at http://msdn.microsoft.com/en-us/library/bb931736.aspx.
In Delphi, you then go to Component menu, Import component and then choose type library. Microsoft Sharepoint should be listed, but if it is not you can browse to find the client library. For Office 2007, that folder is C:\Program Files\Microsoft Office\Office12\OWSSUPP.DLL.
This will create a unit that contains definitions for all the Sharepoint interfaces and CoClasses. You would typically start of with one of the CoClasses, like CoMyStuff.Create to create an object that implements the MyStuff interface. Then follow the MSDN documentation to do what you want.

Related

what's the correct way to get all lists of a site

I need to get all the lists used in my site and render theire items. Since i'm not allowed to use code i have to rely on something like xlst. However after several days of searching i haven't come up with a solution yet. Any idea on how to do this?
Alex depending on what you are trying to do using the client object model may work. This allows you to access SharePoint objects without writing code on the server itself. This does require writing some code but usually a farm admin won't mind it since it doesn't affect SharePoint in any way.
The javascript object model may provide you with what you want.
Here is a link that gets all lists in a SharePoint site
http://msdn.microsoft.com/en-us/library/hh185009
Then to get items from a list
http://msdn.microsoft.com/en-us/library/hh185007
You can using *.asmx Sharepoint services SharePoint 2010 Web Services. Example from Visual Studio: Connecting to SharePoint Online Web Services
and
from Sharepoint Designer: Connect to another library in SharePoint Designer 2010
Good luck!

SharePoint 2010 - Creating a custom document library template

I'm trying to figure out if it is possible to create a custom document library template for SharePoint 2010. When a user clicks on the Libraries link on the quick launch menu of a new SharePoint site, and then clicks the Create button, the Create dialog is launched.
I know this dialog window hosts a Silverlight control, but obviously there is a way to create custom template types in this window. There is even a category that is called Blank & Custom. I've tried copying and modifying the DocumentLibrary feature located in the following location - C:\Program Files\Common Files\Microsoft Shared\Web Server Extensions\14\TEMPLATE\FEATURES, but that didn't seem to work.
Thanks for reading, I'm sure the answer is obvious but I've been stumbling over Google and MSDN all morning trying to figure this out but I haven't had any luck.
Well, unfortunately the answer is not that obvious. You'll have to create a new List Definition (a document library is actually a list). For that there are several ways, but as a developer, I guess the most common way is to do that through Visual Studio.
A basic tutorial that will guide you through the steps can be found here:
http://msdn.microsoft.com/en-us/library/ms466023.aspx
After you deploy your solution, a new list template (or document library, depending what you created) will show up in the dialog.
Yes, it is not that obvious at all.
Most of the Microsoft documentation is now based on using Visual Studio 2010 and are more focused on the lists than on the document libraries.
By the way, as told by Erwin, document libraries in SharePoint 2010 seems to have become lists, but the lack of documentation regarding the creation of custom lists remains anyway, so after having perform some successful trials I have decided to publish a step by step guide.
Sharepoint 2010 custom ducoment library

How to access SharePoint files and folders from outside SharePoint?

I need to programatically interface with SharePoint folders, files and lists from outside SharePoint. Most tutorials focus on working within SharePoint itself, or at least on the same server where SharePoint is installed. I need to automate some tasks from completely different servers -- tasks that require reading SharePoint lists, browsing folders, checking files out and in, reading files stored in SharePoint libraries, etc. It used to be easy using UNC folder and file paths. Now many of our SharePoint sites don't allow UNC access (probably for good reasons), but my needs are the same. What languages / libraries / interfaces will allow this? I'd like to be able to do this from server-side .NET code and from PowerShell scripts (not on the SharePoint server). Thanks for any pointers.
SharePoint offers a web services API. I won't claim it's particularly friendly or fun, but it does work. You can get started learning here.
Use Sharepoint Web Services which provides a suite of standard web service endpoints you can use to do most anything you can through the objet model API.
You can use SPServices whichis a jQuery library which abstracts SharePoint's Web Services and makes them easier to use. It also includes functions which use the various Web Service operations to provide more useful (and cool) capabilities. It works entirely client side and requires no server install.
Here's anoth example of SPServices in use Example
if you are using SharePoint 2010 you can use the Client Side Object Model (http://msdn.microsoft.com/en-us/library/ee537247(v=office.14).aspx). It will help you to access sharepoint objects, lists and everything. There are 3 types one for C#, Silverlight and Javascript.
there are more than one methods:
use csom (client side object model)
use rest services
use sharepoint out of the box web services.
If you want to be able to choose the language in which you program, I'd recommend using the Sharepoint REST API. I'm writing my service in Java, requesting data in JSON, and using Jackson to parse it into Java Objects.

how to deploy a C# code to sharepoint 2007

in SharePoint 2007 (moss)
i need to implement a button . a button to create a custom action. this custom action registers a JavaScript file and a startup script. I have a C# code for this purpose.
i am not sure how to use the C# code. i was told the C# code just needs to be compiled into an assembly and deployed to the SharePoint server. however i dont quite know how can i do that.
( In case required, Reference to what i am trying to do is at this url )
any help appreciated .
In article you see that "feature" file contains
ControlAssembly="SharePointSolutionPack, Version=1.0.0.0, Culture=neutral, PublicKeyToken=4a7cd02bdf107f7a"
ControlClass="Motion10.SharePoint2007.SelectItemsAction"
That means the code goes inside class SelectItemsAction within Motion10.SharePoint2007 namespace.
SharePointSolutionPack is name of Dll file, which, when compiled, you copy to C:\Windows\assembly
However you must also copy feature defintion to (default location): C:\Program Files\Common Files\microsoft shared\Web Server Extensions\12\TEMPLATE\FEATURES
A helpful resource for You
Anyway, what i wrote is not very helpful because i'm not going into details. See this step-by-step example on creating sharepoint button (exactly what you need) that uses Visual Studio extension that helps you develop features and deploy them (without copy-pasting i meantioned above). (You'll learn how to create features with that article)
It is important to learn about sharepoint features, because before i understood how to create features, it was hard to do anything in sharepoint (couldn't understand sharepoint articles, when i saw code, all the time question pops up - where do i put that code?).
Good luck!
Here is a nice walkthrough. Hope it will help you out mate.
Deploy MSDN
Walkthrough: Creating a Webpart

Sharepoint Code Generation Tool

our team is looking to use a code generation tool for the current sharepoint application we are working on. We want to be able to generate most of the stored procedures and business entities instead of having to write them from scratch. Any recommendation what is the best code generation tool to use with sharepoint projects. I am familiar with CodeSmith, but I wasn't sure if there are any better solutions out there for this.
Code generation is not really necessary for SharePoint, all the code is generated in the SharePoint .NET Libraries.
The formulation of your question implies quite serious misunderstandings about SharePoint and it's use of databases.
If you want to talk to a custom database through a generated Data Access Layer, I would say go for the ADO.NET Entity Framework (works with VS2008 SP1 and .NET 3.5 SP1 only though.
A custom solution would be LLBLGen Pro

Resources