Posts

Showing posts with the label SharePoint 2007

SharePoint: Exporting a schema.xml file of a list from a SharePoint site

Image
Sometime we require to add a list definition to our SharePoint deployment package. That can be cumbersome since you need to know the type of fields and their respective attribute. It is easier if the list is made manually on the site and then the schema is exportable and used in the "List definition" code. So here is how we can achieve that: http : //Server/SiteCollection/_vti_bin/owssvr.dll?Cmd=ExportList&List={GUID} Update: For like more than a year now,  I am using SharePoint Manager 2010/2013 to achieve this very conveniently. Reference: http://sharepoint.stackexchange.com/questions/15152/how-can-i-export-a-schema-xml-file-for-a-list-from-a-sharepoint-site Vaqar Hyder E: vaqar.hyder3567@gmail.com A: Siebenbürgen Straße 2/1, Korntal-Münchingen, 70825, PK Hire me on Freelancer.com

SharePoint 2010/2007: What to do when Jquery inside some CEWP messes up the Page/Removing a Bad WebPart

Image
Context: Let me put in this way. I made a custom webpage for a SharePpoint 2010 team site and placed a lot of webparts including a Content Editor webpart that comprised of JQuery and SPServices. Now something may have gone wrong with the jquery code as it is quite vulnerable and that really blocked my page. Solution: The only solution that I could think of at the point in time was to remove the content editor webpart altogether before situation escalates that means nipping the evil in the bud ;). so here was my page http://mysharepointserver/Custom%20Library/CalendarPage.aspx I simply added a query string i.e. Contents=1 so the URL is http://mysharepointserver/Custom%20Library/CalendarPage.aspx?Contents=1  This URL redirected me to a new page called "Web Part Maintenance Page" so here I had the chance to delete the web part that I did not want. Reference(s): https://www.nothingbutsharepoint.com/sites/eusp/Pages/Remove-a-Bad-Web-Part-in-SharePoint.aspx h...

SharePoint 2010: Programmatically wokring with Calculated, Lookup and Hyperlink fields

While working on event receivers in SharePoint 2010, I was required to access thelook up fields and calculated fields in from a list. So here is how I accessed the value of both the fields. SPFieldLookupValue fieldValue = new SPFieldLookupValue(properties.ListItem["ProjectsList"].ToString()); SPFieldCalculated cf = (SPFieldCalculated)properties.ListItem.Fields.GetField("Auslastung"); properties.ListItem["EventHeading"] = fieldValue.LookupValue + ":" + cf.GetFieldValueAsText(properties.ListItem["Auslastung"]); Where as in case you intent to set value for Hyperlink type field it has it own class that can be used in the following manner. SPFieldUrlValue teamURL = new SPFieldUrlValue(); teamURL.Description = "View Team Calendar"; teamURL.Url = properties.Web.Url.ToString() + "\\" + item.Url + "?groupID=" + groupID.ToString(); ; properties.ListItem["ViewTeamCalender"] = teamURL; As you could se...

SharePoint 2010/2007: Setting value of "Person or Group" Column Using SPService

Image
Context: Well I had a list called employees comprising of  two columns: i.e. Title (Single line of text) and  a Person or Group type column that is to be filled with the user. I was trying to fill this column with the current user. Solution  So here is the code that will aid in achieving just that. Click Me! There are number of aspect in this code that need to be addressed. First this is the format of the string that fill s the person or group type column. In normal cases, the item in Person or Group type column shows up in the following format: ID;#Domain\UserName. Here what I used: "-1;#"+loggedinUser So it means you don't need to find ID to form the aforementioned string, rather direct concatinating -1 to the username can do the magic. If somebody is totally unaware about how to use this code, I used content query webpart (out of the box webpart) to write this code. Update: well later I tried to make use of the same technique in the server side ...

SharePoint 2007/2010: Editing a page without "Edit Page" option under Site Action

Image
Context Sometimes it really annoying that I try editing a page in a sharepoint site and found that either the "Edit Page" option is deactivated or hidden under Site Actions. There are two probable  reasons for that. The most common one that leads to this error is if the page is currently checked-out by some other user. So this option is deactivated.  In other case, normally for all List's default  pages such as NewForm.aspx, EditForm.aspx and ViewForm.aspx page's this specific option is disabled.. Now the question arises, how to edit a page in absence of "Edit page" option. Solution: Well what I found  is that by simply adding this “?ToolPaneView=2” to the url of SharePoint redirects us to the edit mode of that specific page. For instance,  If  we have this page http://vaqar-hyder/sites/Users/CRUD_for_List.aspx . To land to the edit mode of this page simply change the URL to: http://vaqar-hyder/sites/Users/CRUD_for_List.aspx ?ToolPaneView=2 . ...