<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>alinolaru.com &#187; SharePoint</title>
	<atom:link href="http://www.alinolaru.com/tag/sharepoint/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.alinolaru.com</link>
	<description>Challenge the possibilities!</description>
	<lastBuildDate>Mon, 26 Oct 2009 12:27:52 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.0</generator>
		<item>
		<title>Soap Server Error When Trying To Edit Pages In SharePoint Designer</title>
		<link>http://www.alinolaru.com/2009/10/soap-server-error-when-trying-to-edit-pages-in-sharepoint-designer/</link>
		<comments>http://www.alinolaru.com/2009/10/soap-server-error-when-trying-to-edit-pages-in-sharepoint-designer/#comments</comments>
		<pubDate>Tue, 06 Oct 2009 21:10:00 +0000</pubDate>
		<dc:creator>Alin Olaru</dc:creator>
				<category><![CDATA[Uncategorized]]></category>
		<category><![CDATA[error]]></category>
		<category><![CDATA[moss]]></category>
		<category><![CDATA[SharePoint]]></category>
		<category><![CDATA[spd]]></category>
		<category><![CDATA[wss]]></category>

		<guid isPermaLink="false">http://www.alinolaru.com/?p=145</guid>
		<description><![CDATA[Another interesting happening from the awesome world of SharePoint errors and (i dare say) bugs is this weird error you can sometimes get when you try to open a page in the SharePoint Designer, particularly a WebPart page, even the Default.aspx. Starting from the beginning, I should remind you how SharePoint web part pages work. [...]]]></description>
			<content:encoded><![CDATA[<p>Another interesting happening from the awesome world of SharePoint errors and (i dare say) bugs is this weird error you can sometimes get when you try to open a page in the SharePoint Designer, particularly a WebPart page, even the Default.aspx. Starting from the beginning, I should remind you how SharePoint web part pages work. The fact of the matter is that while you can edit them and their code in SharePoint Designer, adding/closing/deleting web parts from within the browser interface also modifies the page&#8217;s code.<span id="more-145"></span></p>
<p>What SharePoint won&#8217;t tell you and you have to find out for yourself is that whenever you &#8220;Close&#8221; a WebPart that contains an error it actually remains on the page, even though it&#8217;s hidden. Thus, the page will render fine in the browser and you can be happy to have created an error-free page. But what if you later decide to manually make some changes to the page&#8217;s code? You will soon find out that trying to open it in the SharePoint Designer will cause an error to appear, which tells you that the operation has failed and that the page is unsafe. The error  message is something like the following:</p>
<blockquote>
<p style="text-align: left;">soap:ServerServer was unable to process request. &#8212;&gt; A Web Part or Web Form Control on this Web Part Page cannot be displayed or imported because it is not registered as safe on this site. You may not be able to open this page in an HTML editor that is compatible with Microsoft Windows SharePoint Services, such as Microsoft Office SharePoint Designer. To fix this page, contact the site administrator to have the Web Part or Web Form Control configured as safe.</p>
</blockquote>
<p style="text-align: left;">I have tried to figure out what is wrong and did some searching around and came to the conclusion above. You should use &#8220;Delete&#8221; to eliminate faulty, unsafe or not-working web parts. If you have been using the former method and are stuck with a page that is apparently uneditable in SharePoint Deisgner, try accessing your faulty page with a contents=1 variable, for example: http://my-example.com/Default.aspx?contents=1. This will load the page in maintenance mode and you will be able to spot and remove the errors and unsafe controls. Be wary that you might notice a good series of &#8220;Error&#8221; web parts. Those should be the first ones to go after.</p>
<p style="text-align: left;">After doing the above, try re-opening the page in SPD. You fill find that now you will be able to successfully edit the source code.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.alinolaru.com/2009/10/soap-server-error-when-trying-to-edit-pages-in-sharepoint-designer/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>The Correct Way Of Updating List Items in SharePoint</title>
		<link>http://www.alinolaru.com/2009/09/the-correct-way-of-updating-list-items-in-sharepoint/</link>
		<comments>http://www.alinolaru.com/2009/09/the-correct-way-of-updating-list-items-in-sharepoint/#comments</comments>
		<pubDate>Fri, 04 Sep 2009 14:23:52 +0000</pubDate>
		<dc:creator>Alin Olaru</dc:creator>
				<category><![CDATA[C#]]></category>
		<category><![CDATA[SharePoint]]></category>
		<category><![CDATA[edit list items]]></category>
		<category><![CDATA[moss]]></category>
		<category><![CDATA[wss]]></category>

		<guid isPermaLink="false">http://www.alinolaru.com/?p=122</guid>
		<description><![CDATA[Many times you will need to manipulate data within a list in your custom SharePoint page or web part. Out of these times, you might also need to edit the data in that list like in, for example, a user profile edit page or a contact edit page. Some might say that this is a [...]]]></description>
			<content:encoded><![CDATA[<p>Many times you will need to manipulate data within a list in your custom SharePoint page or web part. Out of these times, you might also need to edit the data in that list like in, for example, a user profile edit page or a contact edit page. Some might say that this is a piece of cake, just assign the required value to the SPListItem and be on your way. Alas, this is not the case, since if you only do this you might realize that the data you need hasn&#8217;t been updated in the database. Though it cannot be called a major inconvenience with the SharePoint object model, it is a bit disorienting and might be a bit of a hassle until you get the actual hang of it.<span id="more-122"></span></p>
<p>Thus, the following would be an example of redundant code that would provide no actual functionality:</p>
<blockquote><p style="color: #ff6600;">SPList uList = SPContext.Current.Site.RootWeb.Lists["Contact Info"];<br />
string fName = &#8243;John&#8243;;<br />
string lName = &#8243;Doe&#8243;;<br />
string cPhone = &#8243;555-123456&#8243;;</p>
<p style="color: #ff6600;">for (int i=0;i&lt;uList.Items.Count;i++)<br />
{<br />
&nbsp;&nbsp;&nbsp;uList.Items[i]["First Name"] = fName;<br />
&nbsp;&nbsp;&nbsp;uList.Items[i]["Last Name"] = lName;<br />
&nbsp;&nbsp;&nbsp;uList.Items[i]["Phone"] = cPhone;<br />
}</p>
</blockquote>
<p>The code above doesn&#8217;t actually do anything, because even though we assign the values we need to the fields and entries we need we don&#8217;t tell SharePoint to also update this into its database. The correct way to do this is to call the Update() method after assigning the values to the fields. But in doing this, we also cannot use the uList.Items[index][fieldName] object, because we cannot use the method with it. Instead, we create a separate SPListItem object and assign the respective entry from the list to that object, like in the example below.</p>
<blockquote><p>SPList uList = SPContext.Current.Site.RootWeb.Lists["Contact Info"];<br />
string fName = &#8243;John&#8243;;<br />
string lName = &#8243;Doe&#8243;;<br />
string cPhone = &#8243;555-123456&#8243;;</p>
<p>for (int i=0;i&lt;uList.Items.Count;i++)<br />
{<br />
&nbsp;&nbsp;&nbsp;SPListItem theContact = uList.Items[i];</p>
<p>&nbsp;&nbsp;&nbsp;theContact["First Name"] = fName;<br />
&nbsp;&nbsp;&nbsp;theContact["Last Name"] = lName;<br />
&nbsp;&nbsp;&nbsp;theContact["Phone"] = cPhone;</p>
<p>&nbsp;&nbsp;&nbsp;theContact.Update();<br />
}</p></blockquote>
]]></content:encoded>
			<wfw:commentRss>http://www.alinolaru.com/2009/09/the-correct-way-of-updating-list-items-in-sharepoint/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Get SharePoint User Information In C#</title>
		<link>http://www.alinolaru.com/2009/08/get-sharepoint-user-information-in-c/</link>
		<comments>http://www.alinolaru.com/2009/08/get-sharepoint-user-information-in-c/#comments</comments>
		<pubDate>Mon, 24 Aug 2009 20:23:32 +0000</pubDate>
		<dc:creator>Alin Olaru</dc:creator>
				<category><![CDATA[C#]]></category>
		<category><![CDATA[SharePoint]]></category>
		<category><![CDATA[moss]]></category>
		<category><![CDATA[user information list]]></category>
		<category><![CDATA[wss]]></category>

		<guid isPermaLink="false">http://www.alinolaru.com/?p=12</guid>
		<description><![CDATA[I am posting this tutorial because it seems there are very few articles on the net that actually present you with a practical way of retrieving SharePoint user information in C#, for example to display in a WebPart. Most of these articles describe the method of programatically achieving this for Microsoft SharePoint Server 2007 (MOSS), [...]]]></description>
			<content:encoded><![CDATA[<p>I am posting this tutorial because it seems there are very few articles on the net that actually present you with a practical way of retrieving SharePoint user information in C#, for example to display in a WebPart. Most of these articles describe the method of programatically achieving this for Microsoft SharePoint Server 2007 (MOSS), but in Windows SharePoint Services (WSS) this bit is more tricky. Mainly because WSS keep only limited user info and also because it uses a hidden list to store that information.<span id="more-12"></span></p>
<p>I&#8217;ll go over the procedures for both MOSS and WSS for comparison.</p>
<h3>Microsoft SharePoint Server 2007</h3>
<p>For MOSS, the process is fairly straightforward. The following code listing should get you going.</p>
<blockquote><p>//These are the libraries you need to reference and include in your WebPart class or your SharePoint page<br />
using Microsoft.Office.Server.UserProfiles;<br />
using Microsoft.SharePoint.Portal.Topology;<br />
using Microsoft.Office.Server;</p>
<p>//This is the actual code for retrieving user info in MOSS, include it where needed<br />
ServerContext context = ServerContext.GetContext(SPContext.Current.Site);<br />
UserProfileManager profileManager = new UserProfileManager(context);<br />
Microsoft.Office.Server.UserProfiles.PropertyCollection props = profileManager.Properties;</p>
<p>foreach (Property prop in props)<br />
{<br />
&nbsp;&nbsp;&nbsp;Response.Write(prop.Name + &#8220;&lt;br/&gt;&#8221;);<br />
}</p>
<p>ServerContext context2 = ServerContext.GetContext(SPContext.Current.Site);<br />
UserProfileManager profileManager2 = new UserProfileManager(context2);<br />
foreach (UserProfile profile in profileManager2)<br />
{<br />
&nbsp;&nbsp;&nbsp;UserProfileValueCollection FirstNameProp = profile["AccountName"];<br />
&nbsp;&nbsp;&nbsp;Response.Write(FirstNameProp[0].ToString() + &#8220;&lt;br/&gt;&#8221;);<br />
}</p></blockquote>
<h3>Windows SharePoint Services 3.0</h3>
<p>For WSS it becomes a bit more tricky. That is because we lack classes the libraries in the example above. WSS stores only partial user info by default, while additional fields and such must be manually added to the list by the website developer/administrator. Apart from that purely administrational issue, the code is also a tad more difficult to implement. Basically, what we do is get this hidden user list and access it not through specialised classes, but like any other normal list and parse through it&#8217;s entries and fields. A code example would be the one below which is used to retrieve the user info for the currently logged user.</p>
<blockquote><p>//These are the libraries you need to reference and include in your WebPart class<br />
using System.Web.UI.WebControls.WebParts;<br />
using Microsoft.SharePoint;<br />
using Microsoft.SharePoint.Administration;</p>
<p>//This assumes you want the WebPart to display basic info about your currently logged in user<br />
protected override void CreateChildControls()<br />
{<br />
&nbsp;&nbsp;&nbsp;base.CreateChildControls();</p>
<p>&nbsp;&nbsp;&nbsp;try<br />
&nbsp;&nbsp;&nbsp;{<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;SPSecurity.RunWithElevatedPrivileges(delegate() {<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;SPList uList = SPContext.Current.Site.RootWeb.Lists["User Information List"];<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;SPUser pUser = SPContext.Current.Site.RootWeb.CurrentUser;<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;int i = FindInList(uList, pUser.ID);</p>
<p>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;if (i != -1)<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;{<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Controls.Add(new LiteralControl(@&#8221;&lt;strong&gt;Name: &lt;/strong&gt;&#8221; + (string)uList.Items[i]["Name"] + @&#8221;&lt;br /&gt;&#8221;));<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Controls.Add(new LiteralControl(@&#8221;&lt;strong&gt;Job Title: &lt;/strong&gt;&#8221; + (string)uList.Items[i]["Job Title"] + @&#8221;&lt;br /&gt;&#8221;));<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Controls.Add(new LiteralControl(@&#8221;&lt;strong&gt;Department: &lt;/strong&gt;&#8221; + (string)uList.Items[i]["Department"] + @&#8221;&lt;br /&gt;&#8221;));<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;}<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;else<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Controls.Add(new LiteralControl(@&#8221;Could not retrieve user info!&#8221;));<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;});<br />
&nbsp;&nbsp;&nbsp;} catch (Exception ex)<br />
&nbsp;&nbsp;&nbsp;{<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Controls.Add(new LiteralControl(@&#8221;&lt;strong&gt;ERROR:&lt;/strong&gt;&lt;br /&gt;&#8221; + ex.Message + &#8221; at &#8221; + ex.Source + &#8220;&lt;br /&gt;Stack Trace:&lt;br /&gt;&#8221; + ex.StackTrace));<br />
&nbsp;&nbsp;&nbsp;}<br />
}</p>
<p>protected int FindInList(SPList uList, int userID)<br />
{<br />
&nbsp;&nbsp;&nbsp;for (int i = 0; i &lt; uList.Items.Count &#8211; 1; i++)<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;if ((int)uList.Items[i]["ID"] == userID)<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;return i;</p>
<p>&nbsp;&nbsp;&nbsp;return -1;<br />
}</p></blockquote>
<p>Let&#8217;s look a bit at the listing and see what do we actually do. First, we use the SPSecurity class to run the code with elevated privileges because the <em>User Information List</em> list is hidden and is not normally visible to normal user, only to those with Admin privileges. Next we set up the uList and pUser objects, the first of which holds the user info list, while the second is a sPUser object holding the basic data for the currently logged in user. I use the FindInList method to retrieve the id of the currently logged in user within the uList.Items collection. Then we verify whether the user was found in the list. If it is there, we show his name, job title and department, else we show a simple message stating we cannot retrieve user info.</p>
<h3>Conclusion</h3>
<p>Windows SharePoint Services uses a more rudimentary system for providing access to its user base to the common developer. MOSS on the other hand has specialized classes for this, making it easier to access the data in a timely generic fashion through the use of the Property object. Well, we&#8217;ll just conclude that this is just one of the many omissions in WSS compared to MOSS, making you curse your days for choosing the <em>free</em> path instead of paying a premium for the full service.  I will return with more basic tutorials covering other aspects of SharePoint Services as I progress in my study and use of this piece of software.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.alinolaru.com/2009/08/get-sharepoint-user-information-in-c/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Of SharePoint And Men</title>
		<link>http://www.alinolaru.com/2009/07/of-sharepoint-and-men/</link>
		<comments>http://www.alinolaru.com/2009/07/of-sharepoint-and-men/#comments</comments>
		<pubDate>Thu, 09 Jul 2009 21:14:22 +0000</pubDate>
		<dc:creator>Alin Olaru</dc:creator>
				<category><![CDATA[SharePoint]]></category>
		<category><![CDATA[Software Reviews]]></category>
		<category><![CDATA[bugs]]></category>
		<category><![CDATA[features]]></category>
		<category><![CDATA[wss]]></category>

		<guid isPermaLink="false">http://www.alinolaru.com/?p=1</guid>
		<description><![CDATA[I&#8217;m going to start my dev journal by expressing my frustrations at Microsoft SharePoint and all that it stands for. Usually, I am a man that likes to create his own solutions from the ground up simply because it&#8217;s better that way. There are several reasons for that, among which the possibility of knowing the [...]]]></description>
			<content:encoded><![CDATA[<p>I&#8217;m going to start my dev journal by expressing my frustrations at Microsoft SharePoint and all that it stands for. Usually, I am a man that likes to create his own solutions from the ground up simply because it&#8217;s better that way. There are several reasons for that, among which the possibility of knowing the classes you work with, creating your own workflow, setting your own standard of functionality. These would be only the major advantages of working with your own code. In the following article I will assess some of the things I like and many more things I dislike about Microsoft&#8217;s SharePoint solution. By &#8220;SharePoint&#8221; I am going to refer to the more crippled edition that is Windows SharePoint Services, available as a free download from Microsoft&#8217;s website and installable on any computer running Windows Server 2003 or 2008.</p>
<p>Now, why have I picked up SharePoint in the first place? Well, sometimes you don&#8217;t get to play by your own rules and a client requests that a specific tool be used in the development of his solution and, since the customer is (almost) always right I set up in my trek amidst the tangled jungle of what is possibly the best and worst thing to happen to ASP.NET-based solutions lately. I&#8217;ve only worked with the thing for 3 weeks now, so I&#8217;m still learning the ropes so I&#8217;ll beg your pardon if I speak out of my league. On the surface, SharePoint looks like a real time and money saver, since it offers a lot of functionality straight out-of-the-box. It handles your security, it handles all those nasty things like organizing your users, permissions, groups, websites, content so you don&#8217;t have to. Basically you could build a simple Team Site for your small business right from the start, without the hassle of writing code, worrying about exceptions, databases, connections, classes and other outerworldly stuff like that.<span id="more-1"></span></p>
<p>What could be wrong with such a real life-saver you ask? Well, the first and most outright flaw is that in protecting your average Joe who just got a job as a website admin at your small business, it also cleverly and sneakily hides errors and exceptions from the naked eye. While I wouldn&#8217;t expect such a solution to start spilling it&#8217;s guts and present tens of lines of exception traces outright on my screen, I&#8217;d still appreciate a bit more than just &#8220;An error has occurred!&#8221; It would help a lot at least pointing a bit in the right direction rather than fully protecting the feeble minded trainee in the arts of drag-and-drop website creation. It is indeed true that more detailed explanations can be found in the Windows Application Log, but these are more often than not cryptical and sometimes not even very accurate.</p>
<p>A second thing, if you can get over the crappy error reporting system, is that it is as pretentious as it is practical. Upon installation, you are asked whether you would like a Standard or a Server Farm installation. Should you make the tragic mistake of choosing a &#8220;Standard&#8221; installation, you&#8217;ll find out you&#8217;ll get more than you bargained for. It will automatically install Windows Internal Database which is basically a named instance of a crippled SQL Server Express Edition [quite straightforwardly named Embedded Edition] and will use that for storing it&#8217;s configuration and website tables and whatnot. I have found that SharePoint can be quite buggy and it at one time simply stopped connecting to this Internal Database [conveniently accessible only through a named pipe]. No reason or explanation provided, the whole thing just refused to stop working. The downside is that since I selected &#8220;Standard&#8221; on installation, I couldn&#8217;t just go back and change to &#8220;Server Farm&#8221; mode. I had to uninstall the blasted thing, manually remove it&#8217;s registry residues and reinstall using the other option.</p>
<p>A third thing would be that it&#8217;s quite buggy. As I&#8217;ve said above, at one time it simply stopped connecting to it&#8217;s damned Internal Database after I have deleted and added a site collection. Also, you sometimes run into an &#8220;unknown error&#8221; here and there that might stunt your workflow. The backup system is simply appalling. While practical in theory by letting you backup your whole website so that it can be moved to another server you run into the impossibility of actually choosing whichever path you&#8217;d like for your backup. You have to provide a UNC path that it has write permissions on. While I could overlook this total lack of common sense of not being able to backup to a local physical path, God help you if your website database is hosted on a remote server, because to backup your database, it&#8217;ll run some stored procedures from within it&#8217;s own database and you&#8217;ll soon find that your UNC path is well&#8230; unknown to that remote server where you keep your database. And then you&#8217;re stuck in a no-exit situation where you can backup the local portion of your website, but your database is stuck somewhere in limbo since it doesn&#8217;t even try to download it somehow, but tries to do everything remotely. Quite a showstopped if you ask me. Thank God that for us geeks there&#8217;s always the <strong>stsadm</strong> command line tool that seems to get the job done faster and better than the graphical interface.</p>
<p>But don&#8217;t be discouraged. While I think there are many more problems with WSS than I managed to find in my short 3 week experience using it, there are many upsides too. It takes care of arduous tasks so you don&#8217;t have to, while you can concentrate on doing the important stuff. It is quite well integrated with your Windows network and with Microsoft&#8217;s solutions such as Office, providing full support for documents. And I must admit it&#8217;s quite fun to work with and code for to some extent. Debugging options are ok, you can always attach the Visual Studio debugger to the aspnet process. All these said, I&#8217;m sure I&#8217;d never use WSS to create any solutions except in the exceptional case when it is expressly requested by the client. I suggest you try it out and give it a  go, maybe it&#8217;ll make your life easier and maybe the boys down in Redmond will find the time to make it as developer-friendly as it is user-friendly. It has great potential but at the same times major flaws that stop it from being a full-fledged one-stop solution to all of our business demands.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.alinolaru.com/2009/07/of-sharepoint-and-men/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>
