Aug
Aug
Aug
Back from vacation!
SharePoint 2010 | No Comments »And as you probably allready know the Service Pack 1 has been release for SharePoint 2010.
May
SharePoint Weather & Clock Web Part
SharePoint 2007, SharePoint 2010 | No Comments »A client of mine asked if they could add a weather & clock web part to their company intranet start page. After looking around for free components online I found none that were flexible enough to incoroprate the graphical guideline.
So I found a tip after some searching around to use the google weather api.
e.g. http://www.google.com/ig/api?weather=New+York this returns an xml file with forcast data. also there are pictures referenced in the xml that you can use to give your web part a more visual look and feel. I had to replace these images with my own. and used the forcast returned as the filename for my pictures. Example given below.
I also incorporate a chache mecahinsm to ensure not to overload the api. more info about that can be found @ http://www.zimmergren.net/archive/2008/10/07/web-part-caching-%E2%80%93-a-simple-approach.aspx
About getting the local time for the selected location I used the following code:
I stored informationa about my locations in a sharepoint custom list with DisplayName, TimeZone and InternalName. TimeZone = The timeszone of the location. e.g Brasilian or Stockholm etc. this is used below in the tz.Description.Contains(data.TimeZone) to get the correct timezone for the location. there are probalby 100 better ways to do this but this one is working fine for me. InternalName is the string i send to google api. e.g. DisplayName New York, InternalName New+York.
SPTimeZoneCollection timeZoneColl = SPRegionalSettings.GlobalTimeZones;
foreach (SPTimeZone tz in timeZoneColl)
{
if (tz.Description.Contains(data.TimeZone))
{
DateTime currentDestDateTime = tz.UTCToLocalTime(DateTime.Now.ToUniversalTime());
data.localTime = currentDestDateTime;
}
}
Even if this code given here is just mumble maybe you can take some parts of it and make your own solution.
Hope it helps!
Br
Christian
Example Methods—————————————————————
private void getmyweatherdataorelse()
{
string googleapiurlandlocation = “http://www.google.com/ig/api?weather=New+York”;
XDocument oLocation = new XDocument();
Encoding enc = Encoding.GetEncoding(“iso-8859-1″);
WebRequest request = WebRequest.Create(googlewatherapiurl);
request.Credentials = CredentialCache.DefaultCredentials;
WebResponse response = request.GetResponse();
Stream dataStream = response.GetResponseStream();
StreamReader reader = new StreamReader(dataStream, enc);
string responseFromServer = reader.ReadToEnd();
reader.Close();
response.Close();
oLocation = XDocument.Parse(responseFromServer, LoadOptions.None);
var datafromxml = (from w in oLocation.Descendants(“current_conditions”)
select new hgsWeatherData
{
DisplayName = location.DisplayName,
forcast = w.Element(“condition”).Attribute(“data”).Value,
temp_celsius = w.Element(“temp_c”).Attribute(“data”).Value,
TimeZone = location.TimeZone
});
foreach (var data in datafromxml)
{
this.Controls.add(new Literal { Text = (hgsWeatherData)data.forcast });
}
}
Example render——————————————————————-
string forcastimagename = data.forcast.ToLower().Replace(” “, “_”);
string html = “<div title=\”"+data.forcast+”\” style=\”position:relative; float:left; text-align:center; width:”+columnwidth+”%;\”>”+
“<div id=\”weather”+data.DisplayName+”\” class=\”hgsWeatherItem\”>”+
“<div class=\”hgsWeatherItemIconWrapper\”>”+
“<image class=\”hgsWeatherItemIcon\” src=\”/_layouts/images/HGS.SP.Home.WP.Weather/”+forcastimagename+”.gif\” alt=\”"+data.forcast+”\” />”+
“<br />”+
“<div class=\”hgsWeatherItemTime\”>”+data.localTime.ToShortTimeString()+”</div>”+
“</div>”+
“</div>”+
“<div id=\”weatherLocation”+data.DisplayName+”\” class=\”hgsWeatherItemLocation\”>”+data.DisplayName+”</div>”+
“</div>”;
Controls.Add(new Literal { Text = html });
Mar
SharePoint development environment and email support.
SharePoint 2007, SharePoint 2010 | Comments OffOne problem I allways face when developing, is how to test email functionallity within a SharePoint development evironment. I usually have one machine that handles AD, DHCP, DNS and then connect my dev computers to this domain. But how about email to send email notifications from workflows etc?
Can I use gmail as an smtp so I dont have to set one up myself? well yes I can ;D
found this quick guide and It works like a charm.
Mar
SharePoint and Dispose
SharePoint 2007, SharePoint 2010 | No Comments »Zimmergren has a great article over at his blog about how to properly find and eliminate Disposeproblems within SharePoint development.
check it out if you havent allready,
To quote Zimmergren:
What if I’m an awesome coder already?
Too many times have I encountered problems in projects due to not properly checking for memory leaks.
Better safe than sorry. That’s all I’m going to say about that
![]()
Mar
SharePoint 2010 missing server side dependencies(not search web part)
SharePoint 2010 | No Comments »A client of ours was complaining about the Central Admin page showing error about Missing Serverside Dependecies. In this case the erro
[MissingWebPart] WebPart class….
This was in our case caused by an uninstalled feature but as usual the Web Part file itself was still available in the web part gallery. To remove this error is quite easy.
1. Delete Web Part in Web Part gallery.
2. Delete Web Part from recycle bin.
3. Delete Web Part from Site Collection Recycle Bin. (End Users)
After this is done. rerun the timer job and the error for missing web part should be gone. If the web part was not deployed to all webb applications. then repeat the steps above for each.
For handling missing setup files or features I found the tool http://featureadmin.codeplex.com/ was quite usefull for finding and removing them from our SharePoint farm.
Feb
Feb
Feb
Feb
SharePoint 2007 Deployment: Overview
SharePoint 2007 | No Comments »A great guide to Development found @ André Vala Blog
Recent Comments