<?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>WSS V3 Archives - Blog IT</title>
	<atom:link href="https://blogit.create.pt/tag/wss-v3/feed/" rel="self" type="application/rss+xml" />
	<link>https://blogit.create.pt/tag/wss-v3/</link>
	<description>Create IT blogger community</description>
	<lastBuildDate>Thu, 10 Jan 2019 14:18:06 +0000</lastBuildDate>
	<language>en-US</language>
	<sy:updatePeriod>
	hourly	</sy:updatePeriod>
	<sy:updateFrequency>
	1	</sy:updateFrequency>
	<generator>https://wordpress.org/?v=6.9.1</generator>
	<item>
		<title>How to upload a list template</title>
		<link>https://blogit.create.pt/ricardocosta/2007/10/17/how-to-upload-a-list-template/</link>
					<comments>https://blogit.create.pt/ricardocosta/2007/10/17/how-to-upload-a-list-template/#respond</comments>
		
		<dc:creator><![CDATA[Ricardo Costa]]></dc:creator>
		<pubDate>Wed, 17 Oct 2007 09:47:00 +0000</pubDate>
				<category><![CDATA[SharePoint 2007]]></category>
		<category><![CDATA[SharePoint]]></category>
		<category><![CDATA[WSS V3]]></category>
		<guid isPermaLink="false">http://blogcreate.azurewebsites.net/ricardocosta/?p=301</guid>

					<description><![CDATA[<p>public static SPFile UploadListTemplate(string siteUrl, string templatePath) { using (SPSite site = new SPSite(siteUrl)) { SPDocumentLibrary templates = (SPDocumentLibrary)site.GetCatalog(SPListTemplateType. ListTemplateCatalog); &#160; System.IO.FileInfo fileInfo = new System.IO.FileInfo(templatePath); byte[] bytes = System.IO.File.ReadAllBytes(fileInfo.FullName); &#160; return templates.RootFolder.Files.Add(fileInfo.Name, bytes); } }</p>
<p>The post <a href="https://blogit.create.pt/ricardocosta/2007/10/17/how-to-upload-a-list-template/">How to upload a list template</a> appeared first on <a href="https://blogit.create.pt">Blog IT</a>.</p>
]]></description>
										<content:encoded><![CDATA[<p><span style="font-size: 9pt">public static SPFile UploadListTemplate(string siteUrl, string templatePath)<br />
</span></p>
<p><span style="font-size: 9pt">{<br />
</span></p>
<p><span style="font-size: 9pt">using (SPSite site = new SPSite(siteUrl))<br />
</span></p>
<p><span style="font-size: 9pt">{<br />
</span></p>
<p style="margin-left: 72pt"><span style="font-size: 9pt">SPDocumentLibrary templates = (SPDocumentLibrary)site.GetCatalog(SPListTemplateType.</span><br />
		<span style="font-size: 9pt">ListTemplateCatalog);<br />
</span></p>
<p>&nbsp;</p>
<p style="margin-left: 36pt"><span style="font-size: 9pt">System.IO.FileInfo fileInfo = new System.IO.FileInfo(templatePath);<br />
</span></p>
<p style="margin-left: 36pt"><span style="font-size: 9pt"> byte[] bytes = System.IO.File.ReadAllBytes(fileInfo.FullName);<br />
</span></p>
<p>&nbsp;</p>
<p style="margin-left: 36pt"><span style="font-size: 9pt">return templates.RootFolder.Files.Add(fileInfo.Name, bytes);<br />
</span></p>
<p><span style="font-size: 9pt">}<br />
</span></p>
<p><span style="font-size: 9pt">}</span></p>
<p>The post <a href="https://blogit.create.pt/ricardocosta/2007/10/17/how-to-upload-a-list-template/">How to upload a list template</a> appeared first on <a href="https://blogit.create.pt">Blog IT</a>.</p>
]]></content:encoded>
					
					<wfw:commentRss>https://blogit.create.pt/ricardocosta/2007/10/17/how-to-upload-a-list-template/feed/</wfw:commentRss>
			<slash:comments>0</slash:comments>
		
		
			</item>
		<item>
		<title>How to upload a site template</title>
		<link>https://blogit.create.pt/ricardocosta/2007/10/17/how-to-upload-a-site-template/</link>
					<comments>https://blogit.create.pt/ricardocosta/2007/10/17/how-to-upload-a-site-template/#respond</comments>
		
		<dc:creator><![CDATA[Ricardo Costa]]></dc:creator>
		<pubDate>Wed, 17 Oct 2007 09:44:00 +0000</pubDate>
				<category><![CDATA[SharePoint 2007]]></category>
		<category><![CDATA[SharePoint]]></category>
		<category><![CDATA[WSS V3]]></category>
		<guid isPermaLink="false">http://blogcreate.azurewebsites.net/ricardocosta/?p=321</guid>

					<description><![CDATA[<p>public static SPFile UploadWebTemplate(string siteUrl, string templatePath) { using (SPSite site = new SPSite(siteUrl)) { SPDocumentLibrary templates = (SPDocumentLibrary)site.GetCatalog(SPListTemplateType.WebTemplateCatalog); &#160; System.IO.FileInfo fileInfo = new System.IO.FileInfo(templatePath); byte[] bytes = System.IO.File.ReadAllBytes(fileInfo.FullName); &#160; return templates.RootFolder.Files.Add(fileInfo.Name, bytes); } }</p>
<p>The post <a href="https://blogit.create.pt/ricardocosta/2007/10/17/how-to-upload-a-site-template/">How to upload a site template</a> appeared first on <a href="https://blogit.create.pt">Blog IT</a>.</p>
]]></description>
										<content:encoded><![CDATA[<p><span style="font-size: 9pt">public static SPFile UploadWebTemplate(string siteUrl, string templatePath)<br />
</span></p>
<p><span style="font-size: 9pt">{<br />
</span></p>
<p><span style="font-size: 9pt">using (SPSite site = new SPSite(siteUrl))<br />
</span></p>
<p><span style="font-size: 9pt">{<br />
</span></p>
<p style="margin-left: 72pt"><span style="font-size: 9pt">SPDocumentLibrary templates = (SPDocumentLibrary)site.GetCatalog(SPListTemplateType.WebTemplateCatalog);<br />
</span></p>
<p>&nbsp;</p>
<p style="margin-left: 36pt"><span style="font-size: 9pt">System.IO.FileInfo fileInfo = new System.IO.FileInfo(templatePath);<br />
</span></p>
<p style="margin-left: 36pt"><span style="font-size: 9pt"> byte[] bytes = System.IO.File.ReadAllBytes(fileInfo.FullName);<br />
</span></p>
<p>&nbsp;</p>
<p style="margin-left: 36pt"><span style="font-size: 9pt">return templates.RootFolder.Files.Add(fileInfo.Name, bytes);<br />
</span></p>
<p><span style="font-size: 9pt">}<br />
</span></p>
<p><span style="font-size: 9pt">}</span></p>
<p>The post <a href="https://blogit.create.pt/ricardocosta/2007/10/17/how-to-upload-a-site-template/">How to upload a site template</a> appeared first on <a href="https://blogit.create.pt">Blog IT</a>.</p>
]]></content:encoded>
					
					<wfw:commentRss>https://blogit.create.pt/ricardocosta/2007/10/17/how-to-upload-a-site-template/feed/</wfw:commentRss>
			<slash:comments>0</slash:comments>
		
		
			</item>
		<item>
		<title>How to create an item in a discussion list</title>
		<link>https://blogit.create.pt/ricardocosta/2007/10/16/how-to-create-an-item-in-a-discussion-list/</link>
					<comments>https://blogit.create.pt/ricardocosta/2007/10/16/how-to-create-an-item-in-a-discussion-list/#respond</comments>
		
		<dc:creator><![CDATA[Ricardo Costa]]></dc:creator>
		<pubDate>Tue, 16 Oct 2007 05:19:13 +0000</pubDate>
				<category><![CDATA[SharePoint 2007]]></category>
		<category><![CDATA[SharePoint]]></category>
		<category><![CDATA[WSS V3]]></category>
		<guid isPermaLink="false">http://blogcreate.azurewebsites.net/ricardocosta/?p=361</guid>

					<description><![CDATA[<p>Creating a discussion in discussion list is different from creating a simple list item. The code for creating a discussion item is: using (SPSite site = new SPSite(&#8220;SITE URL&#8221;)) { using (SPWeb web = site.OpenWeb()) { SPList list =web.Lists[&#8220;LIST TITLE&#8221;]; result = SPUtility.CreateNewDiscussion(list.Items, &#8220;SUBJECT&#8221;); result[SPBuiltInFieldId.Body] = &#8220;BODY&#8221;; result.Update(); } }</p>
<p>The post <a href="https://blogit.create.pt/ricardocosta/2007/10/16/how-to-create-an-item-in-a-discussion-list/">How to create an item in a discussion list</a> appeared first on <a href="https://blogit.create.pt">Blog IT</a>.</p>
]]></description>
										<content:encoded><![CDATA[<p>Creating a discussion in discussion list is different from creating a simple list item. The code for creating a discussion item is:
</p>
<blockquote>
<p><span style="font-size:9pt">using (SPSite site = new SPSite(&#8220;SITE URL&#8221;))<br />
</span></p>
</blockquote>
<blockquote>
<p><span style="font-size:9pt">{<br />
</span></p>
</blockquote>
<blockquote>
<p><span style="font-size:9pt">    using (SPWeb web = site.OpenWeb())<br />
</span></p>
</blockquote>
<blockquote>
<p><span style="font-size:9pt">    {<br />
</span></p>
</blockquote>
<blockquote>
<p><span style="font-size:9pt">        SPList list =web.Lists[&#8220;LIST TITLE&#8221;];<br />
</span></p>
</blockquote>
<blockquote>
<p><span style="font-size:9pt">       result = SPUtility.CreateNewDiscussion(list.Items, &#8220;SUBJECT&#8221;);<br />
</span></p>
</blockquote>
<blockquote>
<p><span style="font-size:9pt">       result[SPBuiltInFieldId.Body] = &#8220;BODY&#8221;;<br />
</span></p>
</blockquote>
<blockquote>
<p><span style="font-size:9pt">       result.Update();<br />
</span></p>
</blockquote>
<blockquote>
<p><span style="font-size:9pt">    }<br />
</span></p>
</blockquote>
<blockquote>
<p><span style="font-size:9pt">}<br />
</span></p>
</blockquote>
<p>The post <a href="https://blogit.create.pt/ricardocosta/2007/10/16/how-to-create-an-item-in-a-discussion-list/">How to create an item in a discussion list</a> appeared first on <a href="https://blogit.create.pt">Blog IT</a>.</p>
]]></content:encoded>
					
					<wfw:commentRss>https://blogit.create.pt/ricardocosta/2007/10/16/how-to-create-an-item-in-a-discussion-list/feed/</wfw:commentRss>
			<slash:comments>0</slash:comments>
		
		
			</item>
		<item>
		<title>Built-In ContentType and Field Ids</title>
		<link>https://blogit.create.pt/ricardocosta/2007/10/04/built-in-contenttype-and-field-ids/</link>
					<comments>https://blogit.create.pt/ricardocosta/2007/10/04/built-in-contenttype-and-field-ids/#respond</comments>
		
		<dc:creator><![CDATA[Ricardo Costa]]></dc:creator>
		<pubDate>Thu, 04 Oct 2007 13:17:00 +0000</pubDate>
				<category><![CDATA[SharePoint 2007]]></category>
		<category><![CDATA[SharePoint]]></category>
		<category><![CDATA[WSS V3]]></category>
		<guid isPermaLink="false">http://blogcreate.azurewebsites.net/ricardocosta/?p=381</guid>

					<description><![CDATA[<p>Only today that I&#039;ve found that the WSS object model has 2 classes that hold all the IDs of the built-in ContentTypes and Fields. Instead of doing things like this: SPListItem item = list.Items.Add(); item[&#34;Title&#34;] = &#34;bla la bla&#34;; You can do item[SPBuiltInFieldId.Title] = &#34;blab la bla&#34;; For the fields you have SPBuiltInFieldId and for [&#8230;]</p>
<p>The post <a href="https://blogit.create.pt/ricardocosta/2007/10/04/built-in-contenttype-and-field-ids/">Built-In ContentType and Field Ids</a> appeared first on <a href="https://blogit.create.pt">Blog IT</a>.</p>
]]></description>
										<content:encoded><![CDATA[<p>Only today that I&#039;ve found that the WSS object model has 2 classes that hold all the IDs of the built-in ContentTypes and Fields.
</p>
<p>Instead of doing things like this:
</p>
<p>SPListItem item = list.Items.Add();
</p>
<p>item[&quot;Title&quot;] = &quot;bla la bla&quot;;
</p>
<p>You can do
</p>
<p>item[SPBuiltInFieldId.Title] = &quot;blab la bla&quot;;
</p>
<p>For the fields you have <a href="http://msdn2.microsoft.com/en-us/library/ms439470.aspx">SPBuiltInFieldId</a> and for the content types <a href="http://msdn2.microsoft.com/en-us/library/ms434482.aspx">SPBuiltInContentTypeId</a>
	</p>
<p><span style="font-family: Wingdings">🙂<br /></span>
	</p>
<p>The post <a href="https://blogit.create.pt/ricardocosta/2007/10/04/built-in-contenttype-and-field-ids/">Built-In ContentType and Field Ids</a> appeared first on <a href="https://blogit.create.pt">Blog IT</a>.</p>
]]></content:encoded>
					
					<wfw:commentRss>https://blogit.create.pt/ricardocosta/2007/10/04/built-in-contenttype-and-field-ids/feed/</wfw:commentRss>
			<slash:comments>0</slash:comments>
		
		
			</item>
		<item>
		<title>ItemUpdating, AfterProperties and field names</title>
		<link>https://blogit.create.pt/ricardocosta/2007/10/02/itemupdating-afterproperties-and-field-names/</link>
					<comments>https://blogit.create.pt/ricardocosta/2007/10/02/itemupdating-afterproperties-and-field-names/#respond</comments>
		
		<dc:creator><![CDATA[Ricardo Costa]]></dc:creator>
		<pubDate>Tue, 02 Oct 2007 06:21:00 +0000</pubDate>
				<category><![CDATA[SharePoint 2007]]></category>
		<category><![CDATA[SharePoint]]></category>
		<category><![CDATA[WSS V3]]></category>
		<guid isPermaLink="false">http://blogcreate.azurewebsites.net/ricardocosta/?p=401</guid>

					<description><![CDATA[<p>I was checking for a field value change in a WSS V3 list with the help of event handlers with no success. In the ItemUpdating event, the list item has the current values of the item and the AfterProperties has the values that the item will have after the update The problem was that I [&#8230;]</p>
<p>The post <a href="https://blogit.create.pt/ricardocosta/2007/10/02/itemupdating-afterproperties-and-field-names/">ItemUpdating, AfterProperties and field names</a> appeared first on <a href="https://blogit.create.pt">Blog IT</a>.</p>
]]></description>
										<content:encoded><![CDATA[<p>I was checking for a field value change in a WSS V3 list with the help of event handlers with no success.
</p>
<p>In the ItemUpdating event, the list item has the current values of the item and the AfterProperties has the values that the item will have after the update
</p>
<p>The problem was that I was using the display name of the field rather than the internal name. In the SPListItem you can use the display name but also the internal name, but with the AfterProperties you can&#039;t use the display name. You must use the internal name of the field.</p>
<p>The post <a href="https://blogit.create.pt/ricardocosta/2007/10/02/itemupdating-afterproperties-and-field-names/">ItemUpdating, AfterProperties and field names</a> appeared first on <a href="https://blogit.create.pt">Blog IT</a>.</p>
]]></content:encoded>
					
					<wfw:commentRss>https://blogit.create.pt/ricardocosta/2007/10/02/itemupdating-afterproperties-and-field-names/feed/</wfw:commentRss>
			<slash:comments>0</slash:comments>
		
		
			</item>
		<item>
		<title>How to add a group to a WSS v3 site</title>
		<link>https://blogit.create.pt/ricardocosta/2007/09/21/how-to-add-a-group-to-a-wss-v3-site/</link>
					<comments>https://blogit.create.pt/ricardocosta/2007/09/21/how-to-add-a-group-to-a-wss-v3-site/#respond</comments>
		
		<dc:creator><![CDATA[Ricardo Costa]]></dc:creator>
		<pubDate>Fri, 21 Sep 2007 10:02:00 +0000</pubDate>
				<category><![CDATA[SharePoint]]></category>
		<category><![CDATA[WSS V3]]></category>
		<guid isPermaLink="false">http://blogcreate.azurewebsites.net/ricardocosta/?p=421</guid>

					<description><![CDATA[<p>Get the group SPGroup group = web.SiteGroups[&#34;GROUP_NAME&#34;]; Create a role assignment SPRoleAssignment newRoleAssignment = new SPRoleAssignment(group); Add the role definition (Full Control, Read, Contribute, &#8230;) to the role assignment newRoleAssignment.RoleDefinitionBindings.Add(web.RoleDefinitions[&#34;Full Control&#34;]); And add the role assignment to the web web.RoleAssignments.Add(newRoleAssignment); &#160;</p>
<p>The post <a href="https://blogit.create.pt/ricardocosta/2007/09/21/how-to-add-a-group-to-a-wss-v3-site/">How to add a group to a WSS v3 site</a> appeared first on <a href="https://blogit.create.pt">Blog IT</a>.</p>
]]></description>
										<content:encoded><![CDATA[<p>Get the group
</p>
<p><span style="font-size: 10pt"><em>SPGroup group = web.SiteGroups[&quot;GROUP_NAME&quot;];<br />
</em></span></p>
<p>Create a <span style="font-size: 10pt">role assignment<em><br />
</em></span></p>
<p><span style="font-size: 10pt"><em>SPRoleAssignment newRoleAssignment = new SPRoleAssignment(group);<br />
</em></span></p>
<p>Add the role definition (Full Control, Read, Contribute, &hellip;) to the role assignment
</p>
<p><span style="font-size: 10pt"><em>newRoleAssignment.RoleDefinitionBindings.Add(web.RoleDefinitions[&quot;Full Control&quot;]);<br />
</em></span></p>
<p>And add the role assignment to the web
</p>
<p><span style="font-size: 10pt"><em>web.RoleAssignments.Add(newRoleAssignment);<br />
</em></span></p>
<p>&nbsp;</p>
<p>The post <a href="https://blogit.create.pt/ricardocosta/2007/09/21/how-to-add-a-group-to-a-wss-v3-site/">How to add a group to a WSS v3 site</a> appeared first on <a href="https://blogit.create.pt">Blog IT</a>.</p>
]]></content:encoded>
					
					<wfw:commentRss>https://blogit.create.pt/ricardocosta/2007/09/21/how-to-add-a-group-to-a-wss-v3-site/feed/</wfw:commentRss>
			<slash:comments>0</slash:comments>
		
		
			</item>
		<item>
		<title>How to use FullTextSqlQuery to search in WSS</title>
		<link>https://blogit.create.pt/ricardocosta/2007/06/15/how-to-use-fulltextsqlquery-to-search-in-wss/</link>
					<comments>https://blogit.create.pt/ricardocosta/2007/06/15/how-to-use-fulltextsqlquery-to-search-in-wss/#respond</comments>
		
		<dc:creator><![CDATA[Ricardo Costa]]></dc:creator>
		<pubDate>Fri, 15 Jun 2007 18:18:00 +0000</pubDate>
				<category><![CDATA[SharePoint]]></category>
		<category><![CDATA[WSS V3]]></category>
		<guid isPermaLink="false">http://blogcreate.azurewebsites.net/ricardocosta/?p=461</guid>

					<description><![CDATA[<p>First, you have to add the following references: Microsoft.Sharepoint Microsoft.Sharepoint.Search Second: DataTable resultsDataTable = new DataTable(); &#160; using (SPSite site = new SPSite(&#34;http://server&#34;)) { FullTextSqlQuery query = new FullTextSqlQuery(site); query.QueryText = queryText; query.ResultTypes = ResultType.RelevantResults; &#160; ResultTableCollection resultTables = query.Execute(); if (resultTables.Count &#62; 0) { ResultTable relevantResults = resultTables[ResulType.RelevantResults]; resultsDataTable.Load(relevantResults, LoadOption.OverwriteChanges); } } &#160; return [&#8230;]</p>
<p>The post <a href="https://blogit.create.pt/ricardocosta/2007/06/15/how-to-use-fulltextsqlquery-to-search-in-wss/">How to use FullTextSqlQuery to search in WSS</a> appeared first on <a href="https://blogit.create.pt">Blog IT</a>.</p>
]]></description>
										<content:encoded><![CDATA[<p>First, you have to add the following references:
</p>
<ul>
<li>Microsoft.Sharepoint
</li>
<li>Microsoft.Sharepoint.Search
</li>
</ul>
<p>Second:
</p>
<p><span style="font-family: Courier New;font-size: 10pt">DataTable resultsDataTable = <span style="color: blue">new</span> DataTable();<br />
</span></p>
<p>&nbsp;</p>
<p><span style="font-family: Courier New;font-size: 10pt"><span style="color: blue">using</span> (SPSite site = <span style="color: blue">new</span> SPSite(<span style="color: #a31515">&quot;http://server&quot;</span>))<br />
</span></p>
<p><span style="font-family: Courier New;font-size: 10pt">{<br />
</span></p>
<p><span style="font-family: Courier New;font-size: 10pt">FullTextSqlQuery query = <span style="color: blue">new</span> FullTextSqlQuery(site);<br />
</span></p>
<p><span style="font-family: Courier New;font-size: 10pt">      query.QueryText = queryText;<br />
</span></p>
<p><span style="font-family: Courier New;font-size: 10pt">      query.ResultTypes = ResultType.RelevantResults;<br />
</span></p>
<p>&nbsp;</p>
<p><span style="font-family: Courier New;font-size: 10pt">      ResultTableCollection resultTables = query.Execute();<br />
</span></p>
<p><span style="font-family: Courier New;font-size: 10pt"><br />
			<span style="color: blue">if</span> (resultTables.Count &gt; 0)<br />
</span></p>
<p><span style="font-family: Courier New;font-size: 10pt">      {<br />
</span></p>
<p><span style="font-family: Courier New;font-size: 10pt">          ResultTable relevantResults = resultTables[ResulType.RelevantResults];<br />
</span></p>
<p><span style="font-family: Courier New;font-size: 10pt">            resultsDataTable.Load(relevantResults, LoadOption.OverwriteChanges);<br />
</span></p>
<p><span style="font-family: Courier New;font-size: 10pt">      }<br />
</span></p>
<p><span style="font-family: Courier New;font-size: 10pt">}<br />
</span></p>
<p>&nbsp;</p>
<p><span style="font-family: Courier New;font-size: 10pt"><span style="color: blue">return</span> resultsDataTable;<br />
</span></p>
<p>&nbsp;</p>
<p>In WSS the only ResultType possible is RelevantResults but you have to define it with the following statement:
</p>
<p><span style="font-family: Courier New;font-size: 10pt">query.ResultTypes = ResultType.RelevantResults;<br />
</span></p>
<p>&nbsp;</p>
<p>If you don&#039;t do that the ResultTableCollection doesn&#039;t return any ResultTable.
</p>
<p>You can control the properties returned in the SELECT statement:
</p>
<p><span style="font-family: Courier New;font-size: 10pt">string queryText = <span style="color: #a31515">&quot;SELECT rank, workid, title, path, author, contenttype from Scope()&quot;</span>;<br />
</span></p>
<p>&nbsp;</p>
<p>If you want you can page the results:
</p>
<p><span style="font-family: Courier New;font-size: 10pt"><span style="color: blue">int</span> pageSize = 3;<br />
</span></p>
<p><span style="font-family: Courier New;font-size: 10pt"><span style="color: blue">int</span> page = 0;<br />
</span></p>
<p>&nbsp;</p>
<p><span style="font-family: Courier New;font-size: 10pt">&#8230;<br />
</span></p>
<p>&nbsp;</p>
<p><span style="font-family: Courier New;font-size: 10pt">query.StartRow = page * pageSize;<br />
</span></p>
<p><span style="font-family: Courier New;font-size: 10pt">query.RowLimit = pageSize;<br />
</span></p>
<p>&nbsp;</p>
<p>To sort the results you use the ORDER BY statment:
</p>
<p><span style="font-family: Courier New;font-size: 10pt">string queryText = <span style="color: #a31515">&quot;SELECT rank, workid, title, path, author, contenttype from Scope() ORDER BY rank ASC, title DESC&quot;</span>;<br />
</span></p>
<p>&nbsp;</p>
<p>I don&#039;t know why but it seems that only the first sort column works. I tried to change the direction and also the property of the second sort column but the results were always ordered the same way.
</p>
<p>&nbsp;</p>
<p>&nbsp;</p>
<p>The post <a href="https://blogit.create.pt/ricardocosta/2007/06/15/how-to-use-fulltextsqlquery-to-search-in-wss/">How to use FullTextSqlQuery to search in WSS</a> appeared first on <a href="https://blogit.create.pt">Blog IT</a>.</p>
]]></content:encoded>
					
					<wfw:commentRss>https://blogit.create.pt/ricardocosta/2007/06/15/how-to-use-fulltextsqlquery-to-search-in-wss/feed/</wfw:commentRss>
			<slash:comments>0</slash:comments>
		
		
			</item>
		<item>
		<title>How to use KeywordQuery to search in WSS</title>
		<link>https://blogit.create.pt/ricardocosta/2007/06/15/how-to-use-keywordquery-to-search-in-wss/</link>
					<comments>https://blogit.create.pt/ricardocosta/2007/06/15/how-to-use-keywordquery-to-search-in-wss/#respond</comments>
		
		<dc:creator><![CDATA[Ricardo Costa]]></dc:creator>
		<pubDate>Fri, 15 Jun 2007 18:13:00 +0000</pubDate>
				<category><![CDATA[SharePoint]]></category>
		<category><![CDATA[WSS V3]]></category>
		<guid isPermaLink="false">http://blogcreate.azurewebsites.net/ricardocosta/?p=481</guid>

					<description><![CDATA[<p>First, you have to add the following references: Microsoft.Sharepoint Microsoft.Sharepoint.Search Second: DataTable resultsDataTable = new DataTable(); &#160; using (SPSite site = new SPSite(&#34;http://server&#34;)) { &#160; KeywordQuery query = new KeywordQuery(site); query.QueryText = queryText; query.ResultTypes = ResultType.RelevantResults; &#160; ResultTableCollection resultTables = query.Execute(); if (resultTables.Count &#62; 0) { ResultTable relevantResults = resultTables[ResultType.RelevantResults]; &#160; resultsDataTable.Load(relevantResults, LoadOption.OverwriteChanges); } &#160; [&#8230;]</p>
<p>The post <a href="https://blogit.create.pt/ricardocosta/2007/06/15/how-to-use-keywordquery-to-search-in-wss/">How to use KeywordQuery to search in WSS</a> appeared first on <a href="https://blogit.create.pt">Blog IT</a>.</p>
]]></description>
										<content:encoded><![CDATA[<p>First, you have to add the following references:
</p>
<ul>
<li>Microsoft.Sharepoint
</li>
<li>Microsoft.Sharepoint.Search
</li>
</ul>
<p>Second:
</p>
<p><span style="font-family: Courier New;font-size: 10pt">DataTable resultsDataTable = <span style="color: blue">new</span> DataTable();<br />
</span></p>
<p>&nbsp;</p>
<p><span style="font-family: Courier New;font-size: 10pt"><span style="color: blue">using</span> (SPSite site = <span style="color: blue">new</span> SPSite(<span style="color: #a31515">&quot;http://server&quot;</span>))<br />
</span></p>
<p><span style="font-family: Courier New;font-size: 10pt">{<br />
</span></p>
<p>&nbsp;</p>
<p><span style="font-family: Courier New;font-size: 10pt">KeywordQuery query = <span style="color: blue">new</span> KeywordQuery(site);<br />
</span></p>
<p><span style="font-family: Courier New;font-size: 10pt">query.QueryText = queryText;<br />
</span></p>
<p><span style="font-family: Courier New;font-size: 10pt">query.ResultTypes = ResultType.RelevantResults;<br />
</span></p>
<p>&nbsp;</p>
<p><span style="font-family: Courier New;font-size: 10pt">      ResultTableCollection resultTables = query.Execute();<br />
</span></p>
<p><span style="font-family: Courier New;font-size: 10pt"><br />
			<span style="color: blue">if</span> (resultTables.Count &gt; 0)<br />
</span></p>
<p><span style="font-family: Courier New;font-size: 10pt">{<br />
</span></p>
<p style="margin-left: 36pt"><span style="font-family: Courier New;font-size: 10pt">ResultTable relevantResults = resultTables[ResultType.RelevantResults];<br />
</span></p>
<p>&nbsp;</p>
<p><span style="font-family: Courier New;font-size: 10pt">          resultsDataTable.Load(relevantResults, LoadOption.OverwriteChanges);<br />
</span></p>
<p><span style="font-family: Courier New;font-size: 10pt">      }<br />
</span></p>
<p>&nbsp;</p>
<p><span style="font-family: Courier New;font-size: 10pt">}<br />
</span></p>
<p>&nbsp;</p>
<p><span style="font-family: Courier New;font-size: 10pt"><span style="color: blue">return</span> resultsDataTable;<br />
</span></p>
<p>&nbsp;</p>
<p>In WSS the only ResultType possible is RelevantResults but you have to define it with the following statement:
</p>
<p><span style="font-family: Courier New;font-size: 10pt">query.ResultTypes = ResultType.RelevantResults;<br />
</span></p>
<p>&nbsp;</p>
<p>If you don&#039;t do that the ResultTableCollection doesn&#039;t return any ResultTable.
</p>
<p>The properties returned are:
</p>
<ul>
<li>Work ID
</li>
<li>Rank
</li>
<li>Title
</li>
<li>Author
</li>
<li>Size
</li>
<li>Path
</li>
<li>Description
</li>
<li>Write
</li>
<li>SiteName
</li>
<li>CollapsingStatus
</li>
<li>HitHighlightedSummary
</li>
<li>HitHighlightedProperties
</li>
<li>ContentClass
</li>
<li>IsDocument
</li>
<li>PictureThumbnailURL
</li>
</ul>
<p>If you want you can control exactly what properties are returned by adding properties to the StringCollection &#8211; query.SelectProperties
</p>
<p>&nbsp;</p>
<p><span style="font-family: Courier New;font-size: 10pt">&#8230;<br />
</span></p>
<p>&nbsp;</p>
<p><span style="font-family: Courier New;font-size: 10pt">query.SelectProperties.Add(&quot;title&quot;);<br />
</span></p>
<p><span style="font-family: Courier New;font-size: 10pt">query.SelectProperties.Add(&quot;size&quot;);<br />
</span></p>
<p>&nbsp;</p>
<p>&nbsp;</p>
<p>In the previous example only the Title and the Size are returned.
</p>
<p>If you want you can page the results:
</p>
<p><span style="font-family: Courier New;font-size: 10pt"><span style="color: blue">int</span> pageSize = 3;<br />
</span></p>
<p><span style="font-family: Courier New;font-size: 10pt"><span style="color: blue">int</span> page = 0;<br />
</span></p>
<p>&nbsp;</p>
<p><span style="font-family: Courier New;font-size: 10pt">&#8230;<br />
</span></p>
<p>&nbsp;</p>
<p><span style="font-family: Courier New;font-size: 10pt">query.StartRow = page * pageSize;<br />
</span></p>
<p><span style="font-family: Courier New;font-size: 10pt">query.RowLimit = pageSize;<br />
</span></p>
<p>&nbsp;</p>
<p>You can sort the results by adding items to the SortCollection list.
</p>
<p><span style="font-family: Courier New;font-size: 10pt">&#8230;<br />
</span></p>
<p>&nbsp;</p>
<p><span style="font-family: Courier New;font-size: 10pt">query.SortList.Add(<span style="color: #a31515">&quot;Rank&quot;</span>, SortDirection.Ascending);<br />
</span></p>
<p><span style="font-family: Courier New;font-size: 10pt">query.SortList.Add(<span style="color: #a31515">&quot;WorkId&quot;</span>, SortDirection.Descending);</span>
	</p>
<p>I don&#039;t know why but it seems that only the first sort item works. I tried to change the direction and also the property of the second sort item but the results were always ordered the same way.</p>
<p>The post <a href="https://blogit.create.pt/ricardocosta/2007/06/15/how-to-use-keywordquery-to-search-in-wss/">How to use KeywordQuery to search in WSS</a> appeared first on <a href="https://blogit.create.pt">Blog IT</a>.</p>
]]></content:encoded>
					
					<wfw:commentRss>https://blogit.create.pt/ricardocosta/2007/06/15/how-to-use-keywordquery-to-search-in-wss/feed/</wfw:commentRss>
			<slash:comments>0</slash:comments>
		
		
			</item>
	</channel>
</rss>
