Category: Server-Side

I’ve never found on my Visual Studio an option to directly add a new WebService file so I looked for a solution and I got this one, I hope it’ll help you: 1. From anywhere in your Solution Explorer (where you want to add the WebService), create a “New Item”. 2. In the “New Item” […]
I’ve found an interesting link about how to retrieve some properties of user profiles in SharePoint 2013 by using its client object model, like this: const string serverUrl = "http://serverName/"; const string targetUser = "domainName\userName"; ClientContext clientContext = new ClientContext(serverUrl); PeopleManager peopleManager = new PeopleManager(clientContext); string[] profilePropertyNames = new string[] { "PreferredName", "Department", "Title" }; […]
Follow this steps to activate the ASP.NET Session in your Server: 1. Open the SharePoint Management Shell. 2. Execute the following command: Enable-SPSessionStateService –DefaultProvision 3. You’ve to change the parameter “enableSessionState” to true on each web application you have: pages enableSessionState="true" enableViewState=.....
Sometimes, when you’re developing a visual web part, the designer file (with .g.cs extension) dissapears in front of your eyes. After finding nothing in the internet, we’ve just discovered why it is happening: You've to add the "Site URL" property in the Project properties. That’s beacuse it is a web part for sharepoint, and Visual […]
Error Cannot have multiple items selected in a DropDownList Solution This message means that you're trying to select an item and another one is already selected. To solve this problem you've to clear the previous selection an then select the new one, like this: myDropDownList.ClearSelection(); myDropDownList.Items.FindByValue(myValue).Selected = true;
If you’ve created your HttpModule correctly but when you open your web it doesn’t work, it could be a configuration error. You should open your web.config and check if your HttpModule is correctly added, because it’s differente between IIS versions: IIS 6 <system.web> <httpModules> <add name="myModule" type="myModuleNamespace.myModuleClass"/> </httpModules> </system.web> IIS 7+ <system.webServer> <modules runAllManagedModulesForAllRequests="true"> <add […]
<configuration> <system.webServer> <validation validateIntegratedModeConfiguration="false"/> <modules runAllManagedModulesForAllRequests="true"> <add name="myModule" type="ModuleNamespace.ModuleClass, ModuleNamespace"/> </modules> </system.webServer> <system.web> <compilation debug="true" targetFramework="4.5" /> <httpRuntime targetFramework="4.5" /> <trust level="Full" originUrl=""/> </system.web> </configuration>
Es posible que nos encontremos con un String que, normalmente por error, contiene espacios al final. Para eliminarlos nos basta con implementar la función “TrimEnd”. string myText = "one;two;three;four;five "; myText = myText.TrimEnd(' '); //El resultado será: "one;two;three;four;five"
El servicio de perfiles de usuarios almacena la información en una ubicación central, a la que podemos acceder desde la propia administración de SharePoint. No obstante, si queremos acceder a través de código podemos encontrarnos con ciertos problemas, siendo la velocidad uno de los principales inconvenientes. En un rango bajo (1-50 usuarios) no tenemos dificultades, […]
El siguiente código nos permitirá hacer una consulta a nuestra base de datos. Tan solo debemos tener una cadena de conexión (que habitualmente situaremos en el fichero de configuración de nuestra aplicación) y la consulta “SELECT” que queramos. using (SqlConnection conn = new SqlConnection(/*Our Connection String*/) { conn.Open(); using (SqlCommand cmd = new SqlCommand(/*Our SELECT […]