Category: Server-Side

A través de una aplicación de consola podemos crear items en una lista utilizando la librería cliente de SharePoint: string siteUrl = "https://mytenant.sharepoint.com/sites/mysite"; using (ClientContext clientContext = new ClientContext(siteUrl)) { […]
Debemos crear un fichero BAT (.bat) en la misma ruta de la DLL que queremos firmar. DEL .\SIGNED_LIBRARY.* /F "C:\Program Files (x86)\Microsoft SDKs\Windows\v7.0A\bin\ildasm.exe" .\LIBRARY.dll /output:.\SIGNED_LIBRARY.il "C:\Windows\Microsoft.NET\Framework\v2.0.50727\ilasm.exe" .\SIGNED_LIBRARY.il /dll /key=.\LIBRARY_KEY.snk /output=.\SIGNED_LIBRARY.dll […]
Este fragmento de código nos permite hacer una llamada a un Web Service REST mediante la librería RestSharp. var client = new RestClient("REST_SERVICE_URL"); client.Authenticator = new HttpBasicAuthenticator("USER", "PASSWORD"); var request […]
Podemos convertir strings, chars y arrays entre si de estas formas:   string -> string[] (Todo el string en un solo elemento del Array) string[] myArray = new []{ myString […]
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 = […]
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. […]
SPSecurity.RunWithElevatedPrivileges(delegate() { using (SPSite site = new SPSite("YOURSITE")) { using (SPWeb web = site.OpenWeb()) { //Obtain the page PublishingPageCollection publishingPages = PublishingWeb.GetPublishingWeb(web).GetPublishingPages(); PublishingPage page = publishingPages.FirstOrDefault(f => f.Uri.AbsoluteUri == "YOURPAGE"); […]
Unpublish and Checkout SharePoint Page: SPSecurity.RunWithElevatedPrivileges(delegate() { using (SPSite site = new SPSite("YOURSITE")) { using (SPWeb web = site.OpenWeb()) { //Obtain the Page PublishingPageCollection publishingPages = PublishingWeb.GetPublishingWeb(web).GetPublishingPages(); PublishingPage page = […]
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: […]
My case: It’s a standard register form created in a SharePoint WebPart (but this error could happen even if you’re not using SharePoint). When I submit the form, sometimes I […]