Skip to content

Instantly share code, notes, and snippets.

Avatar

Robert Curlette rcurlette

View GitHub Profile
@rcurlette
rcurlette / UpdateMMCompMetadataXml.cs
Created May 24, 2018
Tridion Update Multimedia Component Metadata XML using Core Service
View UpdateMMCompMetadataXml.cs
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Xml.Linq;
using Tridion.ContentManager.CoreService.Client;
namespace FixMMCompMetadataField
{
@rcurlette
rcurlette / json_net_sample.cs
Last active Jan 24, 2018
Json.Net Code Sample
View json_net_sample.cs
// get our JSON objects
dynamic jsonObject = JObject.Parse(jsonContent);
dynamic metaPage = jsonObject.MetadataFields;
// check if property exists in the JSON
if (metaPage.Property("contact") == null)
{
dynamic contact = GetContact(sgMetadataFields);
if(contact != null)
{
View List-iis-sites
Import-Module WebAdministration
if(!$web8Files)
{
$logfile = "$PSScriptRoot\Sites_$(get-date -format `"yyyyMMdd_hhmmsstt`").log"
}
#this is our logging function, it must appear above the code where you are trying to use it.
#note there is a technique to get around needing this at the top, read the blog post to find out more...
function log($message, $color)
View Migrate-Sites-ToWeb8-IIS
param
(
[Parameter(Mandatory=$true)][string]$discoveryServiceUrl,
[Parameter(Mandatory=$true)][string]$csvSiteFile
)
#
# .\UpgradeSitesToWeb8.ps1 -discoveryServiceUrl "http://someserver:8882/discovery.svc" -csvSiteFile D:\SiteTest.csv -verbose
#Upgrade each site
View VBScriptMediator
''''''''''''''''''''''''''''''''''''''
' APRIL FOOLS!
'
' For serious fun, go grab a copy of the Razor Mediator and enjoy the power of .Net and a close to TOM API!
' https://code.google.com/p/razor-mediator-4-tridion/
'''''''''''''''''''''''''''''''''''''''
View GetTridionPublishTargets
private List<TridionItem> GetPublishTargets(string publicationUri, SessionAwareCoreServiceClient client)
{
List<TridionItem> pubTargetList = new List<TridionItem>();
var pubTargets = client.GetSystemWideList(new PublicationTargetsFilterData());
foreach (PublicationTargetData pubTargetdata in pubTargets)
{
PublicationTargetData target = (PublicationTargetData)client.Read(pubTargetdata.Id, new ReadOptions());
LinkToPublicationData[] pubDataItems = target.Publications;
foreach (LinkToPublicationData publicationData in pubDataItems)
View CoreServiceImpersonation
string endpointName = "netTcp_2013";
SessionAwareCoreServiceClient client = new SessionAwareCoreServiceClient(endpointName);
client.Impersonate(System.Web.HttpContext.Current.User.Identity.Name);
// Actions- Publish a page, create Component, etc
@rcurlette
rcurlette / EventSystem.dll.config
Last active Aug 29, 2015
Sample EventSystem.dll.config
View EventSystem.dll.config
<?xml version="1.0" encoding="utf-8" ?>
<configuration>
<appSettings>
<add key="ConnectionString" value="Server=ServerX;Database=DbX;User Id=User;Password=pw123"/>
<add key="PublicationConfigComponentWebdavUrl" value="/webdav/002%20Web/Building%20Blocks/System/SystemComponents/PublicationConfigSettings%20DEFAULT.xml"/>
</appSettings>
</configuration>
@rcurlette
rcurlette / TridionEventSystemAppConfigHelper
Last active Aug 29, 2015
Tridion Event System app.config helpers
View TridionEventSystemAppConfigHelper
using System;
using System.Configuration;
using System.Reflection;
using System.Runtime.Caching;
namespace Tridion.EventSystem
{
/// <summary>
/// Configuration file should be named the same as the Event System DLL with '.config' at the end.
/// ie. TridionEventSystem.dll.config
@rcurlette
rcurlette / OrmLiteExample.SqlServer
Last active Aug 29, 2015
ServiceStack ORMLite SqlServer example
View OrmLiteExample.SqlServer
using ServiceStack.DataAnnotations;
using ServiceStack.OrmLite;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace ConsoleApplication1
{
You can’t perform that action at this time.