Crear y añadir columnas a un Content Type via Power Shell

Nota: Al final de la explicación está el código entero para copy-paste. Nota: Si no lo ejecutamos directamente desde la SharePoint Management Shell debemos añadir su SnapIn: Add-PSSnapin "Microsoft.SharePoint.PowerShell" -ErrorAction SilentlyContinue 1. Declaramos el sitio web y el content type al que queremos añadir la columna $web = Get-SPWeb "YOUR_URL" $ctype = $web.contenttypes["YOUR_CONTENTTYPE"] 2. Declaramos …

Sigue leyendo Crear y añadir columnas a un Content Type via Power Shell

Obtener URL de la página de propiedades de un item

A través de esta función podemos obtener la URL para ver las propiedades de un item de una lista de SharePoint: public static string GetItemPropertiesURL(SPListItem item) { string web = item.Web.Url; string listID = item.ParentList.ID.ToString(); string contentType = item.ContentTypeId.ToString(); string itemID = item.ID.ToString(); string url = web + "/_layouts/listform.aspx?PageType=4&ListID={" + listID + "}&ID=" + itemID …

Sigue leyendo Obtener URL de la página de propiedades de un item

Convertir HTML en PDF en C#

Una interesante herramienta para crear facilmente PDFs desde HTML: NReco PdfGenerator. 1. Creamos nuestro HTML string html = "MY_HTML"; 2. Creamos una instancia del conversor var pdfConversor = new NReco.PdfGenerator.HtmlToPdfConverter(); 3. Configuramos las propiedades que necesitemos Modificar el grosor de los margenes pdfConversor.Margins = new NReco.PdfGenerator.PageMargins() { Bottom = 25, Left = 25, Right = 25, …

Sigue leyendo Convertir HTML en PDF en C#

SharePoint Document Library Definition XML Guide (Schema.xml)

Versioning Settings Create a version each time you edit a file in this document library? <List [...] VersioningEnabled="TRUE" EnableMinorVersions="FALSE"  >[...]</List> Advanced Settings Allow management of content types? <List [...] EnableContentTypes="TRUE" >[...]</List> Default open behavior for browser-enabled documents <List [...] DefaultItemOpen="PreferClient" >[...]</List> <List [...] DefaultItemOpen="Browser" >[...]</List> Dialogs (Launch forms in a dialog) <List [...] NavigateForFormsPages="FALSE" >[...]</List> Validation Settings Set …

Sigue leyendo SharePoint Document Library Definition XML Guide (Schema.xml)

Crear SPSubscription Settings Service Application (5 Pasos)

1. Abrir SharePoint Management Shell. 2. Crear el Pool: $AppPool = New-SPServiceApplicationPool -Name SettingsServiceAppPool -Account DOMAINuser 3. Crear la App: $App = New-SPSubscriptionSettingsServiceApplication -ApplicationPool $appPool -Name SettingsServiceApp -DatabaseName SettingsServiceDB 4. Crear el Proxy: $proxy = New-SPSubscriptionSettingsServiceApplicationProxy -ServiceApplication $App 5. Iniciar la instancia: Get-SPServiceInstance | where{$_.TypeName -eq "Microsoft SharePoint Foundation Subscription Settings Service"} | Start-SPServiceInstance

Añadir Vista a Entity Framework sin Primary Key

En ocasiones no podemos añadir una Vista de SQL Server a nuestro modelo de Entity Framework y nos dice que es porque la vista no contiene ninguna "Key". Para resolver este problema debemos tener en cuenta que No se pueden crear Primary Keys en Vistas. La solución para por crear una columna nueva autonumérica. Seguiremos …

Sigue leyendo Añadir Vista a Entity Framework sin Primary Key

Crear punto de acceso Wifi en Windows 8/8.1 (Personal Hotspot)

Para crear un punto de acceso Wifi en nuestro PC y poder conectarnos desde el móvil, tablet, etc. debemos abrir la ventana de comandos (Command Prompt) como administrador y seguimos estos 3 pasos: 1. Comprobar si nuestro PC lo permite netsh wlan show drivers Debemos mirar la propiedad "Hosted network supported" y que sea "Yes". …

Sigue leyendo Crear punto de acceso Wifi en Windows 8/8.1 (Personal Hotspot)

CAML Query Auto-Created in C# with Loops

This is a function in order to create a CAML Query specified for Filters. Once we have the filters, we've to create the parameters for the function, following this template: Parameters Template Name1|Type1|Operation1|Value1,Name2|Type2|Operation2|Value2... [Operation property can only be "Equal" or "Contains", 'cause that's what I need, but it can be modified] Example Title|Text|Contains|Document,Category|Choice|Equal|Docs [Filter items …

Sigue leyendo CAML Query Auto-Created in C# with Loops