Below are the steps you may follow to get started .
STEP 1: Identifying the Core Service Endpoints:
The Tridion Core Service End Points are present in the file: Tridion.ContentManager.CoreService.Client.dll.config
at Path: %TRIDION_HOME%\bin\client\
on the Tridion Server.
They will look something as below:
<client>
<endpoint name="basicHttp_2013"
address="http://localhost/webservices/CoreService2013.svc/basicHttp"
binding="basicHttpBinding" bindingConfiguration="basicHttp"
contract="Tridion.ContentManager.CoreService.Client.ICoreService"/>
<!-- Some More Endpoints will be there here -->
</client>
STEP 2: Adding reference to Core Service
- Add reference to the Tridion DLL:
Tridion.ContentManager.CoreService.Client.dll
- Add the Service Endpoints in your
Web.Config
(Web Applications ) or in your App.config
if using any Console Project.
STEP 3: Initializing the Core Service
Create a Class and initialize the Core Service in the Constructor of the class. Supply the required UserName / Password and use any of the End Points as in Step 1
public class TridionCoreServiceHelper
{
// This EndPoint Name is in the Config as mentioned above
private readonly string endpointName = "basicHttp_2013";
public TridionCoreServiceHelper()
{
client = new CoreServiceClient(endpointName);
client.ClientCredentials.UserName.UserName = // User_Name
client.ClientCredentials.UserName.Password = //Password
}
private CoreServiceClient client;
}
STEP 4: Querying using Tridion Core Service
Once the Service is initialized, Perform the Queries like the Publications List, Publication Targets ...
public XElement GetPublicationList()
{
PublicationsFilterData filter = new PublicationsFilterData();
return client.GetSystemWideListXml(filter);
}
public XElement GetPublicationTargetList()
{
PublicationTargetsFilterData filter = new PublicationTargetsFilterData();
return client.GetSystemWideListXml(filter);
}
Get the Users:
public XElement GetUserGrouptList()
{
UsersFilterData filter = new UsersFilterData();
return client.GetSystemWideListXml(filter);
}
SAMPLE PROJECT: Check this one of the best sample Project by Yabolka on Git Hub
URL : https://github.com/yabolka/TridionCoreServiceAPI