Skip to content

Instantly share code, notes, and snippets.

View rcurlette's full-sized avatar

Robert Curlette rcurlette

View GitHub Profile
@rcurlette
rcurlette / UpdateMMCompMetadataXml.cs
Created May 24, 2018 08:11
Tridion Update Multimedia Component Metadata XML using Core Service
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 January 24, 2018 15:26
Json.Net Code Sample
// 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)
{
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)
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
@rcurlette
rcurlette / VBScriptMediator
Created April 1, 2015 12:49
VBScript Mediator
''''''''''''''''''''''''''''''''''''''
' 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/
'''''''''''''''''''''''''''''''''''''''
@rcurlette
rcurlette / GetTridionPublishTargets
Created January 20, 2015 09:32
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)
@rcurlette
rcurlette / CoreServiceImpersonation
Created January 20, 2015 08:36
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 August 29, 2015 14:13
Sample 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 August 29, 2015 14:13
Tridion Event System app.config helpers
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 August 29, 2015 14:12
ServiceStack ORMLite SqlServer example
using ServiceStack.DataAnnotations;
using ServiceStack.OrmLite;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace ConsoleApplication1
{