<?xml version='1.0' encoding='UTF-8'?><?xml-stylesheet href="http://www.blogger.com/styles/atom.css" type="text/css"?><feed xmlns='http://www.w3.org/2005/Atom' xmlns:openSearch='http://a9.com/-/spec/opensearchrss/1.0/' xmlns:georss='http://www.georss.org/georss' xmlns:gd='http://schemas.google.com/g/2005' xmlns:thr='http://purl.org/syndication/thread/1.0'><id>tag:blogger.com,1999:blog-8460904692663470334</id><updated>2011-10-01T13:39:10.476-07:00</updated><category term='SharePoint'/><category term='Just gibberish'/><category term='Content Types'/><category term='XSL transformation CQWP Dataview webparts'/><category term='People Search'/><category term='Advanced Search'/><category term='Site Columns'/><category term='Fields'/><title type='text'>Kharles Pico's Blog</title><subtitle type='html'>C#, ASP.NET, SharePoint, and all the things I come across</subtitle><link rel='http://schemas.google.com/g/2005#feed' type='application/atom+xml' href='http://kharlesp.blogspot.com/feeds/posts/default'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/8460904692663470334/posts/default?max-results=100'/><link rel='alternate' type='text/html' href='http://kharlesp.blogspot.com/'/><link rel='hub' href='http://pubsubhubbub.appspot.com/'/><author><name>Kharles Pico</name><uri>http://www.blogger.com/profile/16221845211501471549</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><generator version='7.00' uri='http://www.blogger.com'>Blogger</generator><openSearch:totalResults>5</openSearch:totalResults><openSearch:startIndex>1</openSearch:startIndex><openSearch:itemsPerPage>100</openSearch:itemsPerPage><entry><id>tag:blogger.com,1999:blog-8460904692663470334.post-836022368269068384</id><published>2009-01-14T17:14:00.000-08:00</published><updated>2009-01-14T21:17:48.494-08:00</updated><title type='text'>Setting List Item's Content Type even though Content Type is Read Only</title><content type='html'>I was taking over a project which did bulk imports of files into a SharePoint Document Library with specific "Content Types" for each document.&lt;br /&gt;&lt;br /&gt;The guys who had done this developed a console application which would read an xml file and churn through it uploading the file and reading the Content Type and setting it as part of the file upload using this approach:&lt;br /&gt;&lt;br /&gt;**Note removed non-important code&lt;br /&gt;&lt;br /&gt;SPList list = web.Lists["List Name"];&lt;br /&gt;SPFolder itemFolder = list.RootFolder;&lt;br /&gt;SPListItem listItem;&lt;br /&gt;SPFile file;&lt;br /&gt;&lt;br /&gt;file = itemFolder.Files.Add(string.Concat(itemFolder.Url, "/", fileName), stream, true);&lt;br /&gt;file.Update()&lt;br /&gt;&lt;br /&gt;listItem = file.Item;&lt;br /&gt;&lt;br /&gt;SPContentType contentType = list.ContentTypes["Name of Your Content Type"];&lt;br /&gt;&lt;br /&gt;listItem["ContentTypeId"] = contentType.Id;&lt;br /&gt;listItem.SystemUpdate();&lt;br /&gt;&lt;br /&gt;**Note: We can't use the listItem.ContentType = contentType as the .ContentType property is read-only.&lt;br /&gt;&lt;br /&gt;This seemed to do the trick and everything was all okay in SharePoint. I could see that the documents where updated with the correct Content Type and it all seemed to be pretty correct.&lt;br /&gt;&lt;br /&gt;The issue came when the user's started to open the document in Word 2003 and when they clicked on "File Properties" it would always seem to default to the Document Library's default Content Type - not the Content Type in SharePoint - the one that we set during import.&lt;br /&gt;&lt;br /&gt;This was unusual the CT was correct in SharePoint but the Word 2003 properties said otherwise, had a look at the properties in Word and sure enough the ContentTypeId was the correct one (one from SharePoint and migration), however the Content Type property was the default document library one instead. Weird!!!!&lt;br /&gt;&lt;br /&gt;A few hours of digging around and found that I had to set the "ContentType" property as well not just the "ContentTypeId". Once this was done the File Properties document now knew which "Content Type" it was and populated the correct value now. Wowsers it all worked and with only one line of additional code:&lt;br /&gt;&lt;br /&gt;listItem["Content Type"] = contentType.Name;&lt;br /&gt;&lt;br /&gt;Couldn't believe that. I mean why make it Read Only when I can modify the property of the list item? Only issue now was to re-bulk upload 1593 documents JOY!!!!!&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/8460904692663470334-836022368269068384?l=kharlesp.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://kharlesp.blogspot.com/feeds/836022368269068384/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=8460904692663470334&amp;postID=836022368269068384' title='1 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/8460904692663470334/posts/default/836022368269068384'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/8460904692663470334/posts/default/836022368269068384'/><link rel='alternate' type='text/html' href='http://kharlesp.blogspot.com/2009/01/setting-list-items-content-type-even.html' title='Setting List Item&apos;s Content Type even though Content Type is Read Only'/><author><name>Kharles Pico</name><uri>http://www.blogger.com/profile/16221845211501471549</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>1</thr:total></entry><entry><id>tag:blogger.com,1999:blog-8460904692663470334.post-2277452579175032508</id><published>2008-07-31T03:14:00.000-07:00</published><updated>2008-08-03T23:39:18.328-07:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='XSL transformation CQWP Dataview webparts'/><title type='text'>Getting all values to debug xsl in Content Query Webpart</title><content type='html'>Just writing this because I always seem to be looking for it. This basically shows you what properties/fields and the values of these fields in the xsl when you are trying to render in a content query webpart or a dataview webpart.&lt;br /&gt;&lt;br /&gt;&amp;lt;xsl:for-each select="@*"&amp;gt;&lt;br /&gt;Property Name: &amp;lt;xsl:value-of select="name()"/&amp;gt;&lt;br /&gt;Value: &amp;lt;xsl:value-of select="." /&amp;gt; &amp;lt;br/&amp;gt;&lt;br /&gt;&amp;lt;/xsl:for-each&amp;gt;&lt;br /&gt;&lt;br /&gt;Works like a charm. Thanks to everyone else who has blogged about this.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/8460904692663470334-2277452579175032508?l=kharlesp.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://kharlesp.blogspot.com/feeds/2277452579175032508/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=8460904692663470334&amp;postID=2277452579175032508' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/8460904692663470334/posts/default/2277452579175032508'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/8460904692663470334/posts/default/2277452579175032508'/><link rel='alternate' type='text/html' href='http://kharlesp.blogspot.com/2008/07/getting-all-values-to-debug-xsl-in.html' title='Getting all values to debug xsl in Content Query Webpart'/><author><name>Kharles Pico</name><uri>http://www.blogger.com/profile/16221845211501471549</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-8460904692663470334.post-6410293659688195963</id><published>2008-06-02T21:34:00.000-07:00</published><updated>2008-06-03T01:58:48.482-07:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='SharePoint'/><category scheme='http://www.blogger.com/atom/ns#' term='People Search'/><category scheme='http://www.blogger.com/atom/ns#' term='Advanced Search'/><title type='text'>Creating Custom Advanced People Search in MOSS 2007</title><content type='html'>I was working on creating an advanced custom people search page which would provide the client with the ability to build a full text search query based on custom properties such as Skills, Role, Department etc, and came across a few approaches which were very interesting.&lt;br /&gt;&lt;br /&gt;I firstly tried to create my query using the FullTextSqlQuery class which worked just as I wanted - this was awesome I could build my query using dropdown lists using a custom list as the datasource for properties like Role, Department etc. If you're interested in doing this see below for the code:&lt;br /&gt;&lt;br /&gt;&lt;em&gt;private const string SQLQUERYFORMATSTRING = "SELECT {0} FROM SCOPE() WHERE \"scope\"='{1}' {2} ORDER BY Rank DESC";&lt;br /&gt;private const string RESULTFIELDS = "AccountName, PreferredName, JobTitle, Department, OfficeNumber, AboutMe, PictureURL, WorkEmail";&lt;br /&gt;private const string SEARCHSCOPE = "People";&lt;br /&gt;&lt;br /&gt;using (SPSite site = new SPSite(this.Page.Request.Url.ToString()))&lt;br /&gt;{&lt;br /&gt;// create a new FullTextSqlQuery class - use property intializers to set query&lt;br /&gt;FullTextSqlQuery myQuery = new FullTextSqlQuery(site);&lt;br /&gt;myQuery.QueryText = String.Format(SQLQUERYFORMATSTRING, RESULTFIELDS, SEARCHSCOPE, additionalWhereClause);&lt;br /&gt;myQuery.ResultTypes = ResultType.RelevantResults;&lt;br /&gt;myQuery.TrimDuplicates = true;&lt;br /&gt;myQuery.EnableStemming = true;&lt;br /&gt;&lt;br /&gt;// execute the query and load the results into a datatable&lt;br /&gt;ResultTableCollection queryResults = myQuery.Execute();&lt;br /&gt;ResultTable queryResultsTable = queryResults[ResultType.RelevantResults];&lt;br /&gt;DataTable queryDataTable = new DataTable();&lt;br /&gt;queryDataTable.Load(queryResultsTable, LoadOption.OverwriteChanges);&lt;br /&gt;dgListResults.DataSource = queryDataTable;&lt;br /&gt;dgListResults.DataBind();&lt;br /&gt;}&lt;/em&gt;&lt;br /&gt;&lt;br /&gt;Now the problem was how do I render my results? Obviously I could simply fix my Datagrid(dgListResults) to show a nicely formatted result. However I didn't want my results and the search to be on the same page.&lt;br /&gt;&lt;br /&gt;I was told I had to use the OOB core results webpart and this was the big problem I now faced and after some digging I ran into Tom Clarkson's &lt;a href="http://www.tqcblog.com/archive/2007/10/25/creating-a-custom-advanced-search-box-in-moss-2007.aspx"&gt;blog&lt;/a&gt;, and he describes using a custom advanced search box as a basis to pass the search query onto the core results webpart.&lt;br /&gt;&lt;br /&gt;After further &lt;a href="http://blogs.msdn.com/markarend/archive/2007/07/06/moss-search-ui-architecture.aspx"&gt;digging&lt;/a&gt; I found that I could basically build my fulltextsqlquery using this approach. I simply added properties as hidden fields and use the value of input fields as the criteria to search on. I could even run these hidden values on the server, as long as they had the correct IDs ie. (ASB_PS_plb_&lt;property_number&gt;&lt;propnumber&gt;).&lt;br /&gt;&lt;br /&gt;This was very very helpful I could simply point my dropdown list give it the correct ID and fill it with values from a list in SharePoint. The code looked like this:&lt;br /&gt;&lt;br /&gt;&lt;em&gt;private void BindDropDowns()&lt;br /&gt;{&lt;br /&gt;SPSite site = SPContext.Current.Site;&lt;br /&gt;using (SPWeb web = site.RootWeb)&lt;br /&gt;{&lt;br /&gt;&lt;br /&gt;//BindDropDownList&lt;br /&gt;BindDropDownList(web, ASB_PS_pvtb_2, dsRole, "Roles");&lt;br /&gt;BindDropDownList(web, ASB_PS_pvtb_3, dsDepartment, "Business Units");&lt;br /&gt;}&lt;br /&gt;}&lt;br /&gt;&lt;br /&gt;private void BindDropDownList(SPWeb web, DropDownList dropDownList, SPDataSource spDataSource, string listName)&lt;br /&gt;{&lt;br /&gt;spDataSource.List = web.Lists[listName];&lt;br /&gt;dropDownList.DataSource = spDataSource;&lt;br /&gt;dropDownList.DataBind();&lt;br /&gt;}&lt;br /&gt;&lt;br /&gt;&amp;lt;sharepoint:spdatasource runat="server" id="dsRole"&amp;gt;&amp;lt;/sharepoint:spdatasource&amp;gt;&lt;br /&gt;&lt;br /&gt;&amp;lt;sharepoint:spdatasource runat="server" id="dsDepartment"&amp;gt;&amp;lt;/sharepoint:spdatasource&amp;gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&amp;lt;tr&amp;gt;&lt;br /&gt;&amp;lt;td style="width:25%"&amp;gt;&lt;br /&gt;First name / preferred name&amp;lt;br /&amp;gt;&lt;br /&gt;&lt;br /&gt;&amp;lt;input name="ASB_TextDT_Props" type="hidden" value="AccountName#;#FirstName#;#PreferredName#;#LastName#;#JobTitle#;#Department"/&amp;gt;&lt;/em&gt;&lt;br /&gt;&lt;em&gt;&amp;lt;input id="ASB_PS_lolb_0" type="hidden" value="And" runat="server"/&amp;gt;&lt;br /&gt;&amp;lt;input id="txtFirstName" type="text" runat="server" /&amp;gt;&lt;br /&gt;&amp;lt;/td&amp;gt;&lt;br /&gt;&amp;lt;td&amp;gt;&lt;br /&gt;Last Name&amp;lt;br /&amp;gt;&lt;br /&gt;&amp;lt;input id="ASB_PS_plb_1" type="hidden" value="LastName" runat="server"/&amp;gt;&lt;br /&gt;&amp;lt;input id="ASB_PS_olb_1" type="hidden" value="Contains" runat="server"/&amp;gt;&lt;br /&gt;&amp;lt;input type="text" id="ASB_PS_pvtb_1" runat="server"/&amp;gt;&lt;br /&gt;&amp;lt;/td&amp;gt;&lt;br /&gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;&amp;lt;tr&amp;gt;&lt;br /&gt;&amp;lt;td style="width:25%"&amp;gt;&lt;br /&gt;Role &amp;lt;br /&amp;gt;&lt;br /&gt;&amp;lt;input id="ASB_PS_plb_2" type="hidden" value="JobTitle" runat="server" /&amp;gt;&lt;br /&gt;&amp;lt;input id="ASB_PS_olb_2" type="hidden" value="Equals" runat="server" /&amp;gt;&lt;br /&gt;&amp;lt;asp:DropDownList id="ASB_PS_pvtb_2" runat="server" datatextfield="Title" datavaluefield="Title" AppendDataBoundItems="true"&amp;gt;&lt;br /&gt;&amp;lt;asp:ListItem Value="" Text=""&amp;gt;&amp;lt;/asp:ListItem&amp;gt;&lt;br /&gt;&amp;lt;/asp:DropDownList&amp;gt;&lt;br /&gt;&amp;lt;/td&amp;gt;&lt;br /&gt;&amp;lt;td&amp;gt;&lt;br /&gt;Business Unit / Group Function&amp;lt;br /&amp;gt;&lt;br /&gt;&amp;lt;input id="ASB_PS_plb_3" type="hidden" value="Department" runat="server" /&amp;gt;&lt;br /&gt;&amp;lt;input id="ASB_PS_olb_3" type="hidden" value="Equals" runat="server" /&amp;gt;&lt;br /&gt;&amp;lt;asp:DropDownList id="ASB_PS_pvtb_3" runat="server" datatextfield="Title" datavaluefield="Title" AppendDataBoundItems="true"&amp;gt;&lt;br /&gt;&amp;lt;asp:ListItem Value="" Text=""&amp;gt;&amp;lt;/asp:ListItem&amp;gt;&lt;br /&gt;&amp;lt;/asp:DropDownList&amp;gt;&lt;br /&gt;&amp;lt;/td&amp;gt;&lt;br /&gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;&amp;lt;tr&amp;gt;&lt;br /&gt;&amp;lt;td&amp;gt;&amp;lt;asp:Button runat="server" text="Search" id="btnPerformSearch"&amp;gt;&amp;lt;/asp:Button&amp;gt;&lt;br /&gt;&amp;lt;/td&amp;gt;&lt;br /&gt;&amp;lt;/tr&amp;gt;&lt;/em&gt;&lt;br /&gt;&lt;em&gt;&lt;br /&gt;&lt;/em&gt;Now the only thing left to do is add a postbackUrl to the submit button:&lt;br /&gt;this.btnPerformSearch.PostBackUrl = SPContext.Current.Web.Url + SEARCHRESULTSPAGE;&lt;br /&gt;&lt;br /&gt;Just a thing to note ASB_PS_lolb_0 is a one off property value. If you look at the advanced search box it only ever uses And or Or not both, and not between properties :( So you cannot have different property operators between each property, a drawback which unfortunately I needed to try and get around.&lt;br /&gt;&lt;br /&gt;After several misguided attempts I ran into the following hidden property: ASB_ResType_Query - which is basically the Result Type query. I looked at this using the standard OOB and this is what it sets it to either one of these values from the array:&lt;br /&gt;&lt;br /&gt;arrResTypeQuery[1] = 'FileExtension=\u0027htm\u0027 Or FileExtension=\u0027html\u0027 Or FileExtension=\u0027asp\u0027 Or FileExtension=\u0027aspx\u0027 Or FileExtension=\u0027cgi\u0027 Or FileExtension=\u0027php\u0027';arrResTypeQuery[2] = 'FileExtension=\u0027doc\u0027 Or FileExtension=\u0027docx\u0027 Or FileExtension=\u0027dot\u0027';arrResTypeQuery[3] = 'FileExtension=\u0027xls\u0027 Or FileExtension=\u0027xlsx\u0027 Or FileExtension=\u0027xlt\u0027';arrResTypeQuery[4] = 'FileExtension=\u0027ppt\u0027 Or FileExtension=\u0027pps\u0027 Or FileExtension=\u0027pot\u0027';arrResTypeQuery[5] = 'FileExtension=\u0027pdf\u0027';&lt;br /&gt;&lt;br /&gt;So it would seem if you used ASB_ResType_Query to pass on your query it would then append it to the query used specified with the properties. So why not just pass in the whole fulltextsqlquery onto this property as a hidden value? Only problem with that is it doesn't get appended and a fulltextsqlquery isn't run unless there is at least one property search (ASB_PS_plb_&lt;propnumber&gt;) or if the scope is specified (ASB_SS_scb_&lt;index&gt;_&lt;scopeidnumber&gt;) which is what I ended up using.&lt;br /&gt;&lt;br /&gt;Now knowing that I could simply pass on my fulltextsqlquery on to the ASB_ResType_Query and set the scope and do the search - we ended up just building the query using javascript and also added a property for the page to find the scopeidnumber for the "People" search scope:&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;em&gt;protected int PeopleScopeId&lt;br /&gt;{&lt;br /&gt;get&lt;br /&gt;{&lt;br /&gt;//Set Scope Hidden value field to search on people scope&lt;br /&gt;SearchContext context = SearchContext.GetContext(SPContext.Current.Site);&lt;br /&gt;Scopes scopeMgr = new Scopes(context);&lt;br /&gt;Scope scope = scopeMgr.GetSharedScope("People");&lt;br /&gt;return scope.ID;&lt;br /&gt;}&lt;br /&gt;}&lt;/em&gt;&lt;br /&gt;&lt;em&gt;&lt;/em&gt;&lt;br /&gt;&lt;em&gt;protected override void OnLoad(EventArgs e)&lt;br /&gt;{&lt;br /&gt;if (!Page.IsPostBack)&lt;br /&gt;{&lt;br /&gt;BindDropDowns();&lt;br /&gt;}&lt;br /&gt;this.btnPerformSearch.PostBackUrl = SPContext.Current.Web.Url + SEARCHRESULTSPAGE;&lt;br /&gt;this.btnPerformSearch.OnClientClick = "BuildQuery()";&lt;br /&gt;base.OnLoad(e);&lt;br /&gt;}&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&amp;lt;script type="text/javascript"&amp;gt;&lt;br /&gt;var firstNameQuery = "";&lt;br /&gt;function SetFirstNameQuery()&lt;br /&gt;{&lt;br /&gt;var txtFirstName = document.getElementById("&amp;lt;%=txtFirstName.ClientID %&amp;gt;");&lt;br /&gt;if(txtFirstName)&lt;br /&gt;{&lt;br /&gt;if(txtFirstName.value != "")&lt;br /&gt;{&lt;br /&gt;firstNameQuery = "FirstName LIKE '%" + txtFirstName.value + "%' OR PreferredName LIKE '%" + txtFirstName.value + "%'";&lt;br /&gt;}&lt;br /&gt;}&lt;br /&gt;}&lt;br /&gt;&lt;br /&gt;function BuildQuery()&lt;br /&gt;{&lt;br /&gt;//Create First Name/ Preferred Name Query&lt;br /&gt;SetFirstNameQuery();&lt;br /&gt;&lt;br /&gt;if(firstNameQuery != "")&lt;br /&gt;{&lt;br /&gt;finalQuery = firstNameQuery;&lt;br /&gt;}&lt;br /&gt;&lt;br /&gt;element = document.getElementById("ASB_ResType_Query");&lt;br /&gt;if(element)&lt;br /&gt;{&lt;br /&gt;element.value = finalQuery;&lt;br /&gt;}&lt;br /&gt;//alert("Query is: " + element.value)&lt;br /&gt;}&lt;br /&gt;&amp;lt;/script&amp;gt;&lt;br /&gt;&lt;br /&gt;&amp;lt;!--Additional Result Type Query - additional search conditions --&amp;gt;&amp;lt;input name="ASB_ResType_Query" id="ASB_ResType_Query" type="hidden" /&amp;gt;&amp;lt;!--Search on People Scope Id ---&amp;gt;&amp;lt;input name="ASB_SS_scb_0_&amp;lt;%=PeopleScopeId%&amp;gt;" type="hidden" /&amp;gt; &lt;/em&gt;&lt;br /&gt;&lt;br /&gt;&lt;em&gt;&lt;/em&gt;&lt;br /&gt;&lt;br /&gt;Well there we have it and here is a screenshot of it all coming together bar the design:&lt;br /&gt;&lt;br /&gt;&lt;img id="BLOGGER_PHOTO_ID_5207574213473317970" style="DISPLAY: block; MARGIN: 0px auto 10px; CURSOR: hand; TEXT-ALIGN: center" alt="" src="http://2.bp.blogspot.com/_1zDSLn_TrEU/SEUFJ_-PtFI/AAAAAAAAAAc/slDTO4tOgdo/s320/advancedpeoplesearch.gif" border="0" /&gt;&lt;br /&gt;&lt;br /&gt;&lt;p&gt;&lt;/p&gt;&lt;p&gt;Obviously this approach could be incorporated into a custom advanced search box as well without having to mess around with your own custom xsl and results rendering and can simply point it to the OOB search results page or just a page with the Core Results Webpart or the People Core Results webpart.&lt;/p&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/8460904692663470334-6410293659688195963?l=kharlesp.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://kharlesp.blogspot.com/feeds/6410293659688195963/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=8460904692663470334&amp;postID=6410293659688195963' title='8 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/8460904692663470334/posts/default/6410293659688195963'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/8460904692663470334/posts/default/6410293659688195963'/><link rel='alternate' type='text/html' href='http://kharlesp.blogspot.com/2008/06/creating-custom-advanced-people-search.html' title='Creating Custom Advanced People Search in MOSS 2007'/><author><name>Kharles Pico</name><uri>http://www.blogger.com/profile/16221845211501471549</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><media:thumbnail xmlns:media='http://search.yahoo.com/mrss/' url='http://2.bp.blogspot.com/_1zDSLn_TrEU/SEUFJ_-PtFI/AAAAAAAAAAc/slDTO4tOgdo/s72-c/advancedpeoplesearch.gif' height='72' width='72'/><thr:total>8</thr:total></entry><entry><id>tag:blogger.com,1999:blog-8460904692663470334.post-5561231480394615827</id><published>2008-04-17T19:25:00.000-07:00</published><updated>2008-04-21T20:18:51.344-07:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='Site Columns'/><category scheme='http://www.blogger.com/atom/ns#' term='Content Types'/><category scheme='http://www.blogger.com/atom/ns#' term='Fields'/><title type='text'>Rearranging SharePoint Fields</title><content type='html'>Ever wanted to rearrange those annoying fields in EditForm.aspx and NewForm.aspx, without having to modify the actual pages in SharePoint Designer (SPD)? If you did want to use SPD for this please see the following blog which explains very nicely how to do this (&lt;a href="http://kalsing.blogspot.com/2006/11/create-custom-list-form-for-sharepoint.html"&gt;http://kalsing.blogspot.com/2006/11/create-custom-list-form-for-sharepoint.html&lt;/a&gt;). However there is a drawback to this approach as it is a post deploy approach - the site and list has to be already created - what happens when you need to include these field arrangements as part of a site template?&lt;br /&gt;&lt;br /&gt;First of all lets start with the way you deploy your site columns (fields) and content types. Currently we deploy content types and site columns via features. There are lots of blogs out there and even just diving into the HIVE you can see how Microsoft does this out-of-the-box, so I won't go through this in detail (see C:\Program Files\Common Files\Microsoft Shared\Web Server Extensions\12\TEMPLATE\FEATURES\fields and C:\Program Files\Common Files\Microsoft Shared\Web Server Extensions\12\TEMPLATE\FEATURES\ctypes).&lt;br /&gt;&lt;br /&gt;Firstly you define your fields:&lt;br /&gt;&lt;br /&gt;&amp;lt;Field ID="{fa564e0f-0c70-4ab9-b863-0177e6ddd247}"&lt;br /&gt;Name="Title"&lt;br /&gt;SourceID="http://schemas.microsoft.com/sharepoint/v3"&lt;br /&gt;StaticName="Title"&lt;br /&gt;Group="_Hidden"&lt;br /&gt;Type="Text"&lt;br /&gt;DisplayName="$Resources:core,Title;"&lt;br /&gt;Required="TRUE"&lt;br /&gt;FromBaseType="TRUE"&gt;&lt;br /&gt;&amp;lt;/Field&gt;&lt;br /&gt;&lt;br /&gt;&amp;lt;Field id="{fa564e0f-0c70-4ab9-b863-0177e6ddd249}"&lt;br /&gt;Name="FirstTitle"&lt;br /&gt;SourceID="http://schemas.microsoft.com/sharepoint/v3"&lt;br /&gt;StaticName="FirstTitle"&lt;br /&gt;Group="_Hidden"&lt;br /&gt;Type="Text"&lt;br /&gt;DisplayName="First Title"&lt;br /&gt;Required="TRUE"&gt;&lt;br /&gt;&amp;lt;/Field&gt;&lt;br /&gt;&lt;br /&gt;Now you define your content type:&lt;br /&gt;&lt;br /&gt;&amp;lt;ContentType ID="0x01"&lt;br /&gt;Name="$Resources:Item"&lt;br /&gt;Group="$Resources:List_Content_Types"&lt;br /&gt;Description="$Resources:ItemCTDesc"&lt;br /&gt;Version="0"&gt;&lt;br /&gt;&amp;lt;FieldRefs&gt;&lt;br /&gt;&amp;lt;FieldRef ID="{fa564e0f-0c70-4ab9-b863-0177e6ddd247}" Name="Title" Required="TRUE" ShowInNewForm="TRUE" ShowInEditForm="TRUE"/&gt;&lt;br /&gt;&amp;lt;/FieldRefs&gt;&lt;br /&gt;&amp;lt;/ContentType&gt;&lt;br /&gt;&lt;br /&gt;&amp;lt;ContentType ID="0x0101" Name="Child Content Type" Group="$Resources:List_Content_Types" &lt;br /&gt;Description="Child Content Type" &lt;br /&gt;Version="0"&gt; &lt;br /&gt;&amp;lt;FieldRefs&gt; &lt;br /&gt;&amp;lt;FieldRef ID="{fa564e0f-0c70-4ab9-b863-0177e6ddd249}" &lt;br /&gt;Name="FirstTitle" Required="TRUE" ShowInNewForm="TRUE" ShowInEditForm="TRUE"/&gt;&lt;br /&gt;&amp;lt;/FieldRefs&gt;&lt;br /&gt;&amp;lt;FieldRef ID="{fa564e0f-0c70-4ab9-b863-0177e6ddd250}" &lt;br /&gt;Name="SecondTitle" Required="TRUE" ShowInNewForm="TRUE" ShowInEditForm="TRUE"/&gt;&lt;br /&gt;&amp;lt;/FieldRefs&gt;&lt;br /&gt;&amp;lt;/ContentType&gt;&lt;br /&gt;&lt;br /&gt;Now if you bind the Child Content Type to say the Pages library. The fields for the EditForm.aspx and NewForm.aspx will be displayed in the following order:&lt;br /&gt;&lt;br /&gt;Title&lt;br /&gt;First Title&lt;br /&gt;Second Title&lt;br /&gt;&lt;br /&gt;How about if you want First Title to come "First"?&lt;br /&gt;&lt;br /&gt;By simply changing the order of the fields you put inside your content types it will change the order of the way they appear in the EditForm.aspx and NewForm.aspx. So if you referenced Second Title first in the content type the order would change to:&lt;br /&gt;&lt;br /&gt;Title&lt;br /&gt;Second Title&lt;br /&gt;First Title&lt;br /&gt;&lt;br /&gt;That's pretty neat! However what if I wanted "First Title" to go on top of the "Title" field?&lt;br /&gt;&lt;br /&gt;When your content type inherits from the base content types or even content types you've defined then the order in your EditForm.aspx and NewForm.aspx will always show the parents fields first followed by the childs fields.&lt;br /&gt;&lt;br /&gt;How to get around this problem? Simple all you need to do is add the same inherited field into your child content type and arrange it the way you want, this includes the base hidden site columns from the OOB content types. You then would obviously need to bind your content type to the list you want and this should do the trick. So if I wanted to put the fields in the following order:&lt;br /&gt;&lt;br /&gt;First Title&lt;br /&gt;Title&lt;br /&gt;Second Title&lt;br /&gt;&lt;br /&gt;Then I would simply just reference the Title field in the child content type:&lt;br /&gt;&amp;lt;ContentType ID="0x0101" Name="Child Content Type" Group="$Resources:List_Content_Types" &lt;br /&gt;Description="Child Content Type" &lt;br /&gt;Version="0"&gt; &lt;br /&gt;&amp;lt;FieldRefs&gt;&lt;br /&gt;&amp;lt;FieldRef ID="{fa564e0f-0c70-4ab9-b863-0177e6ddd249}" &lt;br /&gt;Name="FirstTitle" Required="TRUE" ShowInNewForm="TRUE" ShowInEditForm="TRUE"/&gt;&lt;br /&gt;&amp;lt;/FieldRefs&gt;&lt;br /&gt;&amp;lt;FieldRef ID="{fa564e0f-0c70-4ab9-b863-0177e6ddd247}" Name="Title" Required="TRUE" ShowInNewForm="TRUE" ShowInEditForm="TRUE"/&gt;&lt;br /&gt;&amp;lt;FieldRef ID="{fa564e0f-0c70-4ab9-b863-0177e6ddd250}" &lt;br /&gt;Name="SecondTitle" Required="TRUE" ShowInNewForm="TRUE" ShowInEditForm="TRUE"/&gt;&lt;br /&gt;&amp;lt;/FieldRefs&gt;&lt;br /&gt;&amp;lt;/ContentType&gt;&lt;br /&gt;&lt;br /&gt;This doesn't seem to break the inheritance of the content types either - just the ordering.&lt;br /&gt;&lt;br /&gt;Apologies for the crappy cut and paste job - someone needs to teach me how to cut and paste properly on this.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/8460904692663470334-5561231480394615827?l=kharlesp.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://kharlesp.blogspot.com/feeds/5561231480394615827/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=8460904692663470334&amp;postID=5561231480394615827' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/8460904692663470334/posts/default/5561231480394615827'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/8460904692663470334/posts/default/5561231480394615827'/><link rel='alternate' type='text/html' href='http://kharlesp.blogspot.com/2008/04/rearranging-sharepoint-fields.html' title='Rearranging SharePoint Fields'/><author><name>Kharles Pico</name><uri>http://www.blogger.com/profile/16221845211501471549</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-8460904692663470334.post-3088150417262136475</id><published>2008-04-17T01:16:00.001-07:00</published><updated>2008-04-17T01:21:03.775-07:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='Just gibberish'/><title type='text'>First Up Blog</title><content type='html'>My first ever posting - I already now feel a little more nerdy :S&lt;br /&gt;&lt;br /&gt;Actually it's about Bloggin time that I finally got off my lazy butt and started bloggin all the things I've learnt and use as a reference just in case I need to do the same thing again, plus I could always just tell people oh I've done that before you should go read my "Blog" how nerdy eh?&lt;br /&gt;&lt;br /&gt;And so the bloggin now begins....&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/8460904692663470334-3088150417262136475?l=kharlesp.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://kharlesp.blogspot.com/feeds/3088150417262136475/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=8460904692663470334&amp;postID=3088150417262136475' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/8460904692663470334/posts/default/3088150417262136475'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/8460904692663470334/posts/default/3088150417262136475'/><link rel='alternate' type='text/html' href='http://kharlesp.blogspot.com/2008/04/first-up-blog.html' title='First Up Blog'/><author><name>Kharles Pico</name><uri>http://www.blogger.com/profile/16221845211501471549</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry></feed>
