HTTP Services With WCF 4 and Windsor
The article shows how to easily create services, and have their dependencies automatically resolved by the Windsor container, with minimal changes.
My blog has moved!
You should be automatically redirected in 4 seconds. If not, visit:
http://itaysagui.wordpress.com
and update your bookmarks.
public static Field EnsureField(this ClientContext clientContext, Web web, Guid id, string name, string schema) { var field = FindField(clientContext, web, f => f.Id == id); if (field != null) return field; var newField = web.Fields.AddFieldAsXml(schema, false, AddFieldOptions.AddToNoContentType | AddFieldOptions.AddFieldInternalNameHint); clientContext.ExecuteQuery(); return newField; }
Labels: .net, Client Object Model, SharePoint
public static bool ExistInContentType( this ClientContext clientContext, ContentType contentType, Field field) { var fieldLinks = contentType.FieldLinks; var existingFields = clientContext.LoadQuery(fieldLinks.Where(fl => fl.Id == field.Id)); clientContext.ExecuteQuery(); var existingField = existingFields.FirstOrDefault(); if (existingField != null) return true; return false; }
Labels: .net, Client Object Model, SharePoint
public static class FieldClientContextExtensions { public static Field FindField(this ClientContext clientContext, List list, Expression<Func<Field, bool>> predicate) { var webFields = list.Fields; var matchingFields = clientContext.LoadQuery(webFields.Where(predicate)); clientContext.ExecuteQuery(); Field field = matchingFields.FirstOrDefault(); return field; } public static Field FindField(this ClientContext clientContext, Web web, Expression<Func<Field, bool>> predicate) { var webFields = web.Fields; var allFields = web.AvailableFields; var matchingWebFields = clientContext.LoadQuery(webFields.Where(predicate)); var matchingAllFields = clientContext.LoadQuery(allFields.Where(predicate)); clientContext.ExecuteQuery(); Field field = matchingWebFields.FirstOrDefault() ?? matchingAllFields.FirstOrDefault(); return field; } }
Labels: .net, Client Object Model, SharePoint
container.Install(FromAssembly.InDirectory(new AssemblyFilter(".")));
public class ExecutingAssemblyFilter : AssemblyFilter { public ExecutingAssemblyFilter() : base(new FileInfo(new Uri(Assembly.GetExecutingAssembly).CodeBase).LocalPath).Directory.ToString()) { } }
container.Install(FromAssembly.InDirectory(new ExecutingAssemblyFilter()));
Labels: .net, development, obfuscation, Windsor
Labels: .net, development, outlook, VSTO