posts - 27, comments - 25, trackbacks - 0

My Links

News

These postings are provided "AS IS" with no warranties, and confers no rights.
Locations of visitors to this page

Tag Cloud

Archives

Post Categories

Wednesday, October 14, 2009

Display the users IP Address in a Data View Web Part

Quite simple really :)

  1. Open up an existing DVWP or create one.
  2. Right click the DVWP and select ‘Common Data View Tasks’ (or click the little arrow that appears on the top right of the DVWP)
  3. Click the ‘Parameters’ link
  4. In the dialog that opens up click the ‘New Parameter’ button.
  5. Provide a name for the parameter (e.g. IPAddress)
  6. In the ‘Parameter Source’ dropdown select ‘Server Variable’
  7. In the ‘Server Variable Name’ text box enter REMOTE_ADDR
  8. Leave the ‘Default Value’ text box empty
  9. Click OK
  10. Now switch to the code view and go to the place where you want the IPAddress to appear and type the following:
  11. <xsl:value-of select="$IPAddress" />

     

    Thats it! Save and open the page containing the DVWP and it should show you you’re IPAddress. I’ve only been able to test it on the intranet and it works fine. If you want to display values of other server variables you can add more parameters and provide the appropriate variable name.

    Here’s a list of server variables: http://www.w3schools.com/asp/coll_servervariables.asp

     

posted @ Wednesday, October 14, 2009 9:20 PM | Feedback (0) | Filed Under [ SharePoint Designer Development ]

Tuesday, October 13, 2009

Data View Web Part error in SharePoint Designer

When I updated the ‘Filter Criteria’ of a fully functioning DVWP through SharePoint designer I was presented with the following error:

The server returned a non-specific error when trying to get data from the data source. Check the format and content of your query and try again. If the problem persists, contact the server administrator.

Took me a while to figure it out. This is what caused it and how to fix it:

When you create a DWVP, SPDesigner adds a parameter called ListID and assigns it the GUID value of the list. I’m sure that you know that in order to make a DVWP ‘portable’ you need to replace ‘ListID’ with ‘ListName’ and the GUID value with the name of the list. This doesn’t break the DVWP’s functionality and lets you use in on any site that has a list with the same name and columns.

However, if you try to edit the filter condition of this ‘portable’ DVWP from the DVWP’s common task pane you’re bound to encounter the above error. The way to recover is to change back ListName to ListID and assign it the GUID value of the list. Once this is done you can make the filter changes and SPDesigner will automatically refresh the DVWP with the correct items. Once you’re satisfied  with the query make the DVWP ‘portable’ like you initially did and add it to your site.

 

posted @ Tuesday, October 13, 2009 9:08 PM | Feedback (2) | Filed Under [ SharePoint Designer ]

Monday, October 12, 2009

Exchange (Outlook) distribution list (mailing group) not showing up in SharePoint

This post is common knowledge to all SharePoint professionals out there, but for newbie's it can save hours of hair pulling (as I’ve got to learn from a bunch of people I’ve helped out) ;) 

Scenario: There is a distribution list you can see and use in outlook, but when you search for the same list in SharePoint it doesn’t show up in the people picker. What gives?

Chances are that the distribution list is not security enabled. This would need to be done by your domain administrator. He would need to change the ‘Group Type’ of the list from ‘distribution’ to ‘security’. Once this is done your SharePoint administrator would need to run a profile import so SharePoint can pick up the change immediately (alternatively you can let SharePoint automatically pick it up during its scheduled AD crawl).

 

Technorati Tags: ,,

posted @ Monday, October 12, 2009 2:38 AM | Feedback (2) |

Saturday, October 10, 2009

Get all replies to a discussion

A discussion list in unlike a normal list in that it consists of two content types  - a Discussion content type that maps to the discussion topic and a Message that maps to all replies to the topic. If you examine the Discussion content type you’ll see that its inherited from the Folder content type.

The reply contains a field called ‘ParentFolderId’ and as the name suggests it holds the ID of the discussion topic. So naturally if you were to do a query on the list for all items with the same ParentFolderId you would expect the query to work. However, since the topic is of a folder content type and the replies are contained within the ‘folder’ you would need to set the  queries ViewAttributes property to "Scope='Recursive'" for it to return results.

Below is an example using the object model:

SPQuery query = new SPQuery();
query.ViewAttributes = "Scope='Recursive'";
StringBuilder queryString = new StringBuilder();
queryString.Append("         <Where>");
queryString.Append("              <And>");
queryString.Append("                        <Eq>");
queryString.Append("                             <FieldRef Name=\"ContentType\" />");
queryString.Append("                             <Value Type=\"Text\">Message</Value>");
queryString.Append("                        </Eq>");
queryString.Append("                        <Eq>");
queryString.Append("                             <FieldRef Name=\"ParentFolderId\" />");
queryString.Append("                             <Value Type=\"Number\">99</Value>"); //NOTE: change this to the value you need
queryString.Append("                        </Eq>");
queryString.Append("              </And>");
queryString.Append("         </Where>");
query.Query = queryString.ToString();
DataTable replyTable = discussionList.GetItems(query).GetDataTable();

 

posted @ Saturday, October 10, 2009 3:40 AM | Feedback (0) |

Saturday, October 03, 2009

mailto with ‘#’ in email address issue

 

It seems that if you use an email address that contains a ‘#’ character and is part of a mailto tag, then clicking on it on the browser will open Outlook, but will not add the complete email address in the ‘To:’ field; it adds all characters until the ‘#’ character.

To overcome this replace the ‘#’ character with %23

So, if you had an email address like: #projectTeam@company.com the mailto tag should have it as %23projectTeam@company.com

 

Technorati Tags:

posted @ Saturday, October 03, 2009 11:21 PM | Feedback (0) |

Tuesday, September 01, 2009

Status of Google services

Use this link (http://www.google.com/appsstatus) to check the status of a Google service (like gmail, gtalk, etc..).

 

Technorati Tags: ,

posted @ Tuesday, September 01, 2009 8:14 PM | Feedback (1) |

Monday, August 24, 2009

SharePoint not crawling links

We have a document library which makes use of the 'Link to a Document' content type which lets users add links to a document library. We noticed that users were using this feature to add links to documents hosted on sites outside of the SharePoint farm. This is all good as far as they are concerned because the content type does its job and end-user can access the external documents by clicking the link.

However, we noticed that none of these links were showing up in the search results. When we looked into the crawl log (/ssp/admin/_layouts/LogSummary.aspx) we found that all these links had an Error status type. The error text was:

This item could not be crawled because the crawler could not connect to the repository. (The item was deleted because it was either not found or the crawler was denied access to it.)

It took some digging, but the issue was because the index server was behind a firewall that was preventing traffic to external sites. Once we made exclusions to the firewall rules (by adding exceptions to the IP address and ports of the external site) and performed a full crawl the links were indexed and started showing up in the search results.

 

posted @ Monday, August 24, 2009 5:30 PM | Feedback (1) |

Thursday, August 20, 2009

A little 'gotcha' when restarting the search service

If you were to restart (i.e stop and then start) the search service, in a SharePoint farm, from the 'Services on server' page in Central Administration chances are that you might encounter both or either of the following errors when yo do a search on your web application:

Your search cannot be completed because of a service error. Try your search again or contact your administrator for more information.

The search request was unable to connect to the Search Service.

This happens because after restarting the service on the index server you need to assign an index server to the SSP. Here are the steps:

1. Start the search services on all the servers that you stopped.

2. Navigate to the Manage SSP page (_admin/managessp.aspx).

3. Place you mouse over the SSP name and select 'Edit Properties' from the drop down menu.

4. In page that opens up, scroll to the end and select the index server from the drop down list box.

5. Hit the OK button to save.

6. Give around 5 to 10 minutes for index propagation and initialization to take place and Search would start working again.

 

Another 'gotcha' to keep note of is that whenever you restart services or assign an index server to the SSP it should be done at a time when the crawler is 'Idle'. Else there is a high probability of the crawler performing an endless crawl.

 

Technorati Tags: ,,,,

posted @ Thursday, August 20, 2009 12:15 PM | Feedback (0) |

Using SharePoint's Rich Text Box in a page

ASP.Net does not provide a rich text box control in its set of web controls. So, if you need to place a rich text box on your SharePoint page you'll have to use a commercial, free or open source text box control (and there are plenty out there). However if you don't want to introduce another dependency, in the form of an external control, you can use SharePoint's built-in rich text box.

If you're creating a page layout that binds to a content types field then its straight forward and you can use RichTextField class. However, if you want to display a textbox that does not interact with a content type then you can use the InputFormTextBox and configure its properties so it render as a rich text box.

Here is an example:

<SharePoint:InputFormTextBox  runat="server" ID="RichTextBox" ValidationGroup="CreateCase" Rows="8" Columns="40" RichText="true" RichTextMode="Compatible" AllowHyperlink="true" TextMode="MultiLine" />

Note: change the RichTextMode value to 'FullHtml' to render more html icons in text box's tool bar.

 

Technorati Tags: ,

posted @ Thursday, August 20, 2009 11:17 AM | Feedback (0) |

Monday, July 20, 2009

CabLib Compress ERROR: Could not flush cabinet: Could not create cabinet file

If you encounter this error when building a WSP it could mean that your files are read-only. Most source control tools mark files as read-only when a file is checked in. Either use the source controls tool to make the file writeable or right-click the file (or root folder) select Properties and uncheck Read-Only.

 

posted @ Monday, July 20, 2009 3:34 PM | Feedback (0) |

Powered by: