Browsed by
Tag: C#

SharePoint: Updating file/folder metadata with a # in the name

SharePoint: Updating file/folder metadata with a # in the name

For the longest time this wasn’t an issue. There were just certain characters that weren’t allowed as file or folder names in the Windows world (%&#/\ and so on). Not too long ago, Microsoft decided it’s ok to accept files and folders in SharePoint with either the % or the # in the file or folder name. Great for end users who enjoy that sort of thing…awful for us developers. For example, in the past I’m sure you did something…

Read More Read More

Writing to the ULS in SharePoint 2010

Writing to the ULS in SharePoint 2010

Here’s a quick, easy, 3 step method to log your custom events to the ULS while writing a SharePoint 2010 solution: Add a reference to Microsoft.Office.Server (located in C:Program FilesCommon FilesMicrosoft SharedWeb Server Extensions14ISAPI on your SharePoint server) Add a using statement at the top of your code like so: using Microsoft.Office.Server.Diagnostics; Add the following line wherever you want the message to appear in the ULS PortalLog.LogString(<whatever you want to put in the ULS>) See? That wasn’t so bad!

Visual Studio language support for C# not installed

Visual Studio language support for C# not installed

What?  I just get a new dev laptop (yeah, pretty proud myself, HP Pavilion dv7, triple-core i5, 6GB RAM, 640GB HD, 17.3″ display…) and I install VS 2008 and 2010, SQL, etc.  Start working on an existing website using VS 2008 and it says “Visual Studio language support for C# is not installed.  Code-editing Intellisense will not be available.  Markup Intellisense for server controls may not work”.  You gotta be kidding me… So I hit the googleverse and attempt to…

Read More Read More

Getting local IP address programmatically in Windows 7

Getting local IP address programmatically in Windows 7

I created a small client app for my company that required the local IP address (assigned by DHCP) to determine what site it was on. It reads the second octet value, which is consistent with each of our buildings in our enterprise. From here, I can determine what content to load so no matter where the PC is placed, it automatically grabs content only specific to that location. Anyway, when testing this application on Windows 7 it doesn’t load any…

Read More Read More

Excellent article on getting AD info using C#

Excellent article on getting AD info using C#

I’m always getting, updating, and validating against AD info at my company, and today I needed to pull several different schema attributes in one method, and kept running into more and more trouble. Code got bigger and bigger, and I thought there had to be a way to simplify this. I then ran across a CodeProject article definitely worth mentioning. The author, Rajasekhara Sambangi does an excellent job of demonstrating a simplified way of pulling just about anything from AD…

Read More Read More