• Sayantan Basu

Connect Core Service API (As an administrator User) using C#

The Tridion Core Service is the most powerful API that gives us access to everything in the Tridion system. When you are trying to connect the core service API from your .NET code then either you can use your logged-on user credential or connect to the Core Server as an admin user(or different user) if you do not want to connect as the currently logged-on user.

This requires you to provide your administrator user id and password, or for your current user to have impersonation rights.

There are several way to implement this, but I am sharing one of the easiest way to access the core service client from your solution.

Here is my code –

/// <summary> /// Core service client configuration /// </summary> /// <returns>return the client detail</returns> public static CoreServiceClient GetCoreServiceSettings() { var binding = new NetTcpBinding { MaxReceivedMessageSize = 2147483647, ReaderQuotas = new XmlDictionaryReaderQuotas { MaxStringContentLength = 2147483647, MaxArrayLength = 2147483647 } }; var endpoint = new EndpointAddress(“net.tcp://localhost:2660/CoreService/2013/netTcp”); var client = new CoreServiceClient(binding, endpoint); client.ChannelFactory.Credentials.Windows.ClientCredential = new NetworkCredential(“YourAdminUserID”,”Password”); return client; }

You can create this method under the UTIL class so that you can connect the client from your own class.

#TridionCoreService

© 2019 by Sayantan Basu