Tuesday, December 28, 2010

Parser Error in sharepoint


Today I have faced parser error in SharePoint when someone has changed compat.browser file in
SharePoint designer.

After searching in Google, I found that some of file App_Browsers folder was corrupted. I have deleted file from folder and reset IIS. My site is working fine.





Saturday, December 4, 2010

SharePoint search using FullTextSqlQuery

//SharedServices2 refers to the Shared Service Provider servicing
ServerContext context = ServerContext.GetContext("SharedServices2");
FullTextSqlQuery qrySearch = new FullTextSqlQuery(context);
//Specifies the results set containing the main search results from
//the content index matching the search query.
qrySearch.ResultTypes = ResultType.RelevantResults;
//Sremming : expansion of searches to include plural forms and
//other word variations :-)
qrySearch.EnableStemming = true;
qrySearch.TrimDuplicates = false;
qrySearch.QueryText = "SELECT URL, Title, Size, Write, HitHighlightedSummary FROM SCOPE() where \"scope\"='NTFS Archive' And FREETEXT(*,'" + TextBox1.Text.Trim() +
"')";
ResultTableCollection results = qrySearch.Execute();
ResultTable resultTable = results[ResultType.RelevantResults];
// Data Table to Store Search Results
DataTable dtResults = new DataTable();
dtResults.Load(resultTable, LoadOption.OverwriteChanges);

Friday, November 12, 2010

Unable to cast object of type 'Microsoft.SharePoint.Administration.SPWebApplication' to type 'Microsoft.SharePoint.SPSite

Today I have found error "Unable to cast object of type Microsoft.SharePoint.Administration.SPWebApplication' to type 'Microsoft.SharePoint.SPSite" during deploy moss 2010 solution.

I have set scope as "Site" and due to that above issue is occured.
I have changed scope as "WebApplication" and rebuild it and after deploy it.
So Its working Fine and solution is deployed successfully.

Cheers.

Workflow Custom Activity in MOSS 2010

http://www.zimbio.com/VisualStudio/articles/qMY82wdzeBR/Walkthrough+3+SharePoint+Designer+Workflows
http://sharepointbloggin.com/2010/02/10/walkthrough-3-sharepoint-designer-workflows-imported-to-visual-studio-2010/

Thursday, November 4, 2010

an unhandled exception occurred in the silverlight application sharepoint 2010

I guess it's a product bug. Just Enable the Security Validation from Manage Web Applications --> General Settings (from ribbon).

Silverlight Application is unable to connect to the WCF endpoint configured by the product for enabling Client Object Model, if Security validation is set to Off.

Enjoy...

Tuesday, October 5, 2010

Could not load type ‘System.Data.Services.Providers.IDataServiceUpdateProvider’ from assembly ‘System.Data.Services, Version=3.5.0.0, Culture=neutral,

I wanted to use the new REST services in SharePoint 2010. But when I navigated to the ListData.svc service. I got the following error:


Could not load type ‘System.Data.Services.Providers.IDataServiceUpdateProvider’ from assembly ‘System.Data.Services, Version=3.5.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089′.

does not provide many hints to what is causing this error. Most sites suggest to install ADO.NET Data Services v1.5 CTP2, but I already had.

I have found solution from one of sharepoint blog which asking to install dll patch on sharepoint server.


For Windows 7 AND Windows Server 2008 R2Download the ADO.NET Data Services Update for .NET Framework 3.5 SP1 for Windows 7 and Windows Server 2008 R2.

After installing the version of the System.Data.Services.dll file is 3.5.30729.5004.

For Windows 2000, Windows XP, Windows Vista, Windows Server 2003 AND Windows Server 2008Download the ADO.NET Data Services Update for .NET Framework 3.5 SP1 for Windows 2000, Windows Server 2003, Windows XP, Windows Vista and Windows Server 2008.

After installing the version of the System.Data.Services.dll file is 3.5.30729.4466.

Friday, September 17, 2010

User Profile Synchronization error MOSS MA not found

I had this problem and found that the Forefront Identity Management Service was not running I went into Start -> Administrator Tools -> Services and started it and everything worked !

I can confirm that the resolution to this issue is to restart the following services:
- Forefront Identity Manager Service
- ForeFront Identity Manager Synchronization Service

Through Services in Administrative Tools (or services.msc in Run command).


Sunday, September 12, 2010

Powerpoint and WordViewer services not found in MOSS 2010

Hi friend,
I have checked my central administration and found that powerpoint and word viewer services are not installed on server. I have googling and found that Microsoft Web Application patch is needed for this service.

Below are some reference link which have mentioned how to install and configure powerpoing and word viewer services on central admin.

http://technet.microsoft.com/en-us/library/ff431687.aspx
http://www.microsoft.com/downloads/en/details.aspx?FamilyID=27d81b1c-18ae-4983-8e1c-224bb747eb99&displaylang=en
http://support.microsoft.com/kb/2028346
http://www.sharepoint24x7.com/tag/sharepoint-foundation-2010/

Saturday, September 11, 2010

MOSS 2010 Application Service

(1) Access Services View/Edit/Interact with Access 2010 DB’s in the browser Cache
(2)Business Data Connectivity Access LOB data DB
(3)Excel Services View/Edit/Interact with Ecel 2010 files Cache
(4)Managed Metadata Service Access managed taonomy hierarchies, keywords, and social tagging infrastructure as well as Content Type publishing across site collections DB
(5)PerformancePoint Provides the capabilities of PerformancePoint Services Cache
(6)PowerPoint View/Edit/Broadcast PowerPoint presentations in a web browser Cache
(7)Search Crawls content, produces inde partitions, serves search queries DB
(8)Secure Store Services Provides single sign-on authentication to access multiple applications or services DB
(9)State Service Provides Temporary Storage of user session data for SharePoint Server components DB
(10)Usage and Health Data Collection Collects farm wide usage and health data and provides the ability to view various reports DB
(11)User Profile Adds support for My Sites, Profile pages, Social Tagging, and other social computing features DB
(12)Visio Graphics Service Viewing and refreshing of Visio diagrams in the browser BLOB cache
(13)Web Analytics Provides Web Service interfaces

Performance Point Service in MOSS 2010

http://blogs.msdn.com/b/performancepoint/archive/2009/11/24/deploying-performancepoint-2010-soup-to-nuts.aspx

Thursday, September 9, 2010

Request for permission of type 'Microsoft.Office.Access.Server.Security.AccessServicesPermission,

Below are steps to solve above problem

(1) Modify the C:\Program Files\Microsoft SQL Server\MSRS10_50.MSSQLSERVER\Reporting Services\ReportServer\rsreportserver.config file on the Reporting Services server. Under the node, under the node, add the ADS data extension. For example:
<Extension Name="ADS" Type="Microsoft.Office.Access.Reports.DataProcessing.AdsConnection, Microsoft.Office.Access.Server.DataServer, Version=14.0.0.0, Culture=Neutral, PublicKeyToken=71e9bce111e9429c"/> -->


(2)Modify the rssrvpolicy file on RS server.

Add the following XML code in the file under the node.

<PermissionSet class="NamedPermissionSet" version="1" Name="ReportExpressionsDefaultPermissionSet">
<IPermission class="SecurityPermission" version="1" Flags="Execution" />
<IPermission class="Microsoft.Office.Access.Server.Security.AccessServicesPermission, Microsoft.Office.Access.Server.Security,
Version=14.0.0.0, Culture=neutral, PublicKeyToken=71e9bce111e9429c" version="1.0" Flags="CalculationCallback" />
</PermissionSet>


(3) In the node, find the following line and change PermissionSetName from “Execution” to “ReportExpressionsDefaultPermissionSet”

<CodeGroup class="UnionCodeGroup" version="1" PermissionSetName="Execution" Name="Report_Expressions_Default_Permissions"
Description="This code group grants default permissions for code in report expressions and Code element. ">

You tried to use an extension for the data 'ADS' not registered for this report server or not supported in this edition of Reporting Services

(1) Go

C:\Program Files\Microsoft SQL Server\MSRS10_50.MSSQLSERVER\Reporting Services\ReportServer\rsreportserver.config

(2)Remove the comment markers () off of the Data Extension for ADS.

(3) Once the comments were removed from the ADS extension, the SQL reports began working immediately.

Integration Reporting Services with MOSS 2010

http://blogen.siderys.com/2010/02/installing-reporting-service.html
http://phase2.com/blog/?p=1320

Tuesday, June 8, 2010

Sharepoint designer : Workflow is not start automatically


I’ve been playing with SharePoint Designer Workflows heavily for the past few days. Suddenly I came across the problem of these workflows does not start automatically though I select the option to start the workflow when an item is created or modified in a list or library.
Browse the web and found the reason of installing Windows SharePoint Services 3.0 Service Pack 1 which caused the problem. This behavior occurs because a security fix in Windows SharePoint Services 3.0 SP1 prevents declarative workflows from starting automatically under the system account.

You could fall in to 1 of the 3 scenarios given below while you faced this problem…
1) The Windows SharePoint Services Web application runs under a user's domain account.
2) The user logs in by using this domain account.
3) The site displays the user name as System Account.
Answer / Solution
Set the application pool to use a different user account than System Account.
Step by Step Guide.
1) Open SharePoint Central Administration.
2) Go to Operations Tab.
3) Under Security Configurations click on Service Accounts.
4) Select “Web application pool” option button.
5) In the web service drop down box select “Windows SharePoint Services Web Application”.
6) And in the Application pool drop down, select the application pool you want.
7) Next select the “Configurable” option button and then type the user name and password of a user having rights to assign to an application pool.













8) Go to command prompt and type iisreset /noforce
9) Make sure to test the workflow log-in in to SharePoint other than System Account.

Monday, May 31, 2010

Using SharePoint Calculated Columns to Display Current Month List Items


  1. Created First Day Of Month

    =DATE(YEAR([Created]),MONTH([Created]),1)

  2. Created Last Day Of Month

    =DATE(YEAR([Created]),MONTH([Created])+1,1)-1

I then added the below filters to view:



Richtextbox in sharepoint

<%@ Register TagPrefix="SharePointSD" Namespace="Microsoft.SharePoint.WebControls" Assembly="Microsoft.SharePoint, Version=12.0.0.0, Culture=neutral,PublicKeyToken=71e9bce111e9429c" %>


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

Sunday, May 30, 2010

Microsoft.SharePoint.SPListItem.PrepareItemForUpdate + SPWorkflowTask.AlterTask + Task not updated

Hi Guys,

Today I have tried to updated task list item in workflow but everytime i was getting Microsoft.SharePoint.SPListItem.PrepareItemForUpdate error when updated item.

I have used taskcontenttype for aspx task form in my workflow. I have updated task using SPWorkflowTask.AlterTask but not solved my problem.

Solution :

Put FieldRefs in contentType XML.

<?xml version="1.0" encoding="utf-8"?>
<Elements xmlns="http://schemas.microsoft.com/sharepoint/">
<ContentType ID="0x01080100DB4541EA29924902A6635A9D335C698B"
Name="SOP Issue WF Content Type1"
Group="SOP Issue"
Description="SOP Issue WF Content Type Task"
Version="0"
Hidden="FALSE">
<FieldRefs>

</FieldRefs>
<XmlDocuments>
<XmlDocument NamespaceURI="http://schemas.microsoft.com/sharepoint/v3/contenttype/forms/url">
<FormUrls xmlns="http://schemas.microsoft.com/sharepoint/v3/contenttype/forms/url">
<New>_layouts/SOPIssueWF/Task1EditForm.aspx</New>
<Display>_layouts/SOPIssueWF/Task1EditForm.aspx</Display>
<Edit>_layouts/SOPIssueWF/Task1EditForm.aspx</Edit>
</FormUrls>
</XmlDocument>
</XmlDocuments>
</ContentType>
</Elements>


Thursday, May 27, 2010

How to get current logged in user in sharepoint object model

using (SPSite site = new SPSite(SPContext.Current.Web.Url.ToString()))
{
using (Microsoft.SharePoint.SPWeb web1 = site.OpenWeb())
{
using (Microsoft.SharePoint.SPWeb web = SPControl.GetContextWeb(Context))

{

SPUser currentuser = web.CurrentUser;

}
}
}

Tuesday, May 18, 2010

MOSS 2007 Problem : Cannot connect to the configuration database.

Hi Guys,

During my work with MOSS 2007,i had some performance issues regarding the SQL Server instance services which is running the configuration and Data for MOSS sites.

I had closed this service bymistake and when i'm trying to open the central administration site or any site i got this message in the IR:

"Cannot connect to the configuration database."

To resolve this : go to your services and start this service:
"SQL Server (MSSQLSERVERS)"

This Tip is enough to continue your work with your MOSS sites.

Hope this helps

Monday, April 19, 2010

Your changes conflict with those made concurrently by another user. If you want your changes to be applied, click Back in your Web browser.

Today I am facing save conflict problem when i am updating list item during itemupdating event.

I have found solution after Research.

using (SPSite oSiteCollection = new SPSite(properties.WebUrl.ToString()))
{
using (SPWeb oWebsiteRoot = oSiteCollection.OpenWeb())
{
int count = 0;
oWebsiteRoot.AllowUnsafeUpdates = true;

SPList list = oWebsiteRoot.Lists[properties.ListId];
SPListItem oItem = list.GetItemById(properties.ListItemId);
if (oItem["Request_x0020_Counter"] != null && oItem["Request_x0020_Counter"].ToString() != string.Empty)
{
count += Convert.ToInt32(oItem["Request_x0020_Counter"].ToString()) + 1;
}
else
{
count += count + 1;
}
properties.AfterProperties["Request_x0020_Counter"] = count;



}
}

Friday, April 16, 2010

PDF Convertor for SharePoint

Hi Guys,

I have uploaded word to pdf feature in codeplex. Please find attachment in source code tab in below link.

Link : http://word2pdf.codeplex.com/

Thursday, April 15, 2010

Programmatically update workflow history on specific list

using (SPSite site = new SPSite("http://MOSS:5858"))

{

using (Microsoft.SharePoint.SPWeb web = site.OpenWeb())

{



web.AllowUnsafeUpdates = true;

SPList historyList = web.Lists["Workflow History"];

SPListItem item = historyList.Items.Add();



item["Description"] = "testing";

item["WorkflowInstance"] = "{7CF46B1F-42C8-4E0A-80D3-EBEFD670AC63}";



item.Update();

}

}

Programmatically Update Hyperlink in sharepoint list

SPFieldUrlValue linkUrl = new SPFieldUrlValue();
linkUrl.Description = "Completed";
linkUrl.Url = "http://www.google.co.in"
item["WF Status"] = linkUrl;

Saturday, April 10, 2010

MOSS 2007 Script Collection

http://www.powershell.nu/2009/09/08/moss-2007-script-collection/

Monday, April 5, 2010

Errors were found when compiling the workflow.The workflow files were saved but cannot be run.

I have installed third party feature on sharepoint after that this problem is created.

Solution :

Check web.config file authorizedTypes section.


Wednesday, March 31, 2010

Sharepoint Shortcut Name



BDC = Business Data Catalog and Backup Domain Controller

BI = Business Intelligence

CA = Central Administration and Certificate Authority

CMS = Content Management Server

DMZ = Demilitarized Zone

ECM = Enterprise Content Management

ECS = Excel Calculation Server

KPI = Key Performance Indicators

IIS = Internet Information Services

ISA = Internet Security and Acceleration Server

MMC = Microsoft Management Console

MOSS = Microsoft Office SharePoint Server 2007

O12 = Office 12

OFS = Office Forms Server

OSS = Office SharePoint Server, Office Server System and Open Source System

PDC = Primary Domain Controller

PKI = Public Key Infrastructure

RFC = Request for Comments

SPS = SharePoint Portal Server

SSL = Secure Sockets Layer

STS = SharePoint Team Services

SSP = Shared Services Provider

TLS = Transport Layer Security

URL = Uniform Resource Locater

URN = Uniform Resource Name

URI = Uniform Resource Identifier

VS = Virtual Server 2005, Virtual Server and Visual Studio

VSS = Visual Source Safe, Volume Shadow Copy Service

WA = Web Application

WAS = Web Application Stress tool

WCM = Web Content Management

WSS = Windows SharePoint Services, Web Storage System and Windows Server System

WWF = Windows Workflow Foundation and Worldwide Wrestling Federation

Wednesday, March 24, 2010

SharePoint jQuery: Setting View Column Width

A very common request for changes to SharePoint list views is how to set the column width. This is not possible to do using the ootb "List Settings", and the common suggested fix is to use SharePoint Designer (SPD) and convert the view into an "XSLT Data View": How can I manage columns widths in list views? Most large companies do, however, prevent the use of SPD.

With jQuery there is no need to use SPD or to convert the view. In the following example jQuery will change the width of the two columns "Status description" and "Type of Work" by changing their CSS style attribute.

Start by looking up the HTML markup for the two table headers using View-Source. I'm using jQuery filters that look for the TH elements using a CSS class selector and a content filter. Then add a Content Editor web-part (CEWP) to your page and enter this script in the source editor:

<!--ADJUST TABLE COLUMN WIDTH-->
<script src="http://ajax.googleapis.com/ajax/libs/jquery/1.2.6/jquery.min.js" type="text/javascript"></script>
<script type="text/javascript">
$(function(){
$("TH.ms-vh2-nograd:contains('Status description')").css("width", "150px");
$("TH.ms-vb:contains('Type of Work')").css("width", "150px");
});
</script>

Tuesday, March 23, 2010

This solution contains no resources scoped for a Web application and cannot be deployed to a particular Web application

Scenario:
You scoped your solution to WebApplication and trying to deploy the solution to a particular Web Application

Error:
This solution contains no resources scoped for a Web application and cannot be deployed to a particular Web application.

OR

This solution contains no resources scoped for a Web application and cannot be retracted from a particular Web application.


Reason:
Its because of the parameters passed to STSADM , basically features included in the solution does not contain an assembly which can be scoped to a particular Web Application. What ever assemblies are part of solution are suppose to go GAC and that makes solution a candidate for Global deployment.

Resolution:
Before you read the resolution below: Here's a comment that seems to be more better solution

"Better fix your solution by adding some dummy element that will make the solution deploy-able to a web application. If you have multiple web applications in your farm, usually you don't want to deploy your feature to all of them."

If that is not possible

Remove the URL parameter from STSADM. Do not use the Url parameter with the STSADM command while deploying or retracting such a solution


stsadm -o deploysolution -name SolutionFileName -local stsadm -o retractsolution -name SolutionFileName -local

Monday, March 22, 2010

How to get display form URL of a list item

using Microsoft.SharePoint;
using Microsoft.SharePoint.Utilities;

SPListItem item = GetItem(); // some code to get a list item
SPList list = item.ParentList;
SPWeb web = list.ParentWeb;

string webUrl = web.Url;
string dispUrl = item.ContentType.DisplayFormUrl;
if(dispUrl == "")
dispUrl = list.Forms[PAGETYPE.PAGE_DISPLAYFORM].Url;
bool isLayouts = dispUrl.StartsWith("_layouts/",StringComparison.CurrentCultureIgnoreCase);
dispUrl = String.Format("{0}/{1}?ID={2}",webUrl,dispUrl,item.ID);
if(isLayouts)
dispUrl = String.Format("{0}&List={1}",dispUrl,SPEncode.UrlEncode(list.ID+""));
As a result, you will get full display form URL of a list item. However, if you want to get just a “clickable” URL, to place in some hyperlink, you don’t need to write so much code. You may create URL by using only an address of a list display form. SharePoint will analyze provided ID of an item then and redirect your request to appropriate page. You may code just:

SPListItem item = GetItem(); // some code to get a list item
SPList list = item.ParentList;
SPWeb web = list.ParentWeb;
string webUrl = web.Url;
string dispUrl = list.Forms[PAGETYPE.PAGE_DISPLAYFORM].Url;;
dispUrl = String.Format("{0}/{1}?ID={2}",webUrl,dispUrl,item.ID);

Wednesday, March 17, 2010

SharePoint DateTime Control Date Format

Normally Sharepoint Datetime control take MM/dd/yyyy date format by default. If your sharepoint site regional settings is different then its mandetory to change date time control property to set original date format for sharepoint control.

<SharePoint: DateTimeControl runat="server".... />



Put



LocaleId="2057"

before the /> bit at the end.

Sharepoint 2010 Key Improvements from MOSS




Thanks to Sushant

Sunday, March 14, 2010

Date Time Control In Sharepoint


<%@ Register TagPrefix="SharePointSD" Namespace="Microsoft.SharePoint.WebControls"
Assembly="Microsoft.SharePoint, Version=12.0.0.0, Culture=neutral,
PublicKeyToken=71e9bce111e9429c" %>
<div>
<table>
<tr>
<td style="width: 100px">
Start Date</td>
<td style="width: 100px">
<SharePointSD:DateTimeControl runat="server" ID="dteDemo1" DateOnly="True">
<asp:TextBox runat="server" MaxLength="45" CssClass="ms-input" ID="dtpDateTimeIdentifierTextBox1">
</asp:TextBox>
</SharePointSD:DateTimeControl>
</td>
<td style="width: 100px">
End Date</td>
<td style="width: 100px">
<SharePointSD:DateTimeControl runat="server" ID="dteDemo2" DateOnly="True">
<asp:TextBox runat="server" MaxLength="45" CssClass="ms-input" ID="dtpDateTimeIdentifierTextBox2">
</asp:TextBox>
</SharePointSD:DateTimeControl>
</td>
</tr>
<tr>
<td style="width: 100px">
</td>
<td colspan="3">
<asp:CompareValidator id="cv" runat="server" ForeColor="red" Type="date" Operator="GreaterThan" ErrorMessage="End Date shoule be greater than start date"

ControlToCompare="dteDemo1$dteDemo1Date" ControlToValidate="dteDemo2$dteDemo2Date" ></asp:CompareValidator></td>
</tr>


</table>

</div>

Wednesday, February 10, 2010

Free Weather Web part





















using System;
using System.Collections;
using System.Configuration;
using System.IO;
using System.Net;
using System.Web;
using System.Web.Caching;
using System.Web.UI;
using System.Web.UI.WebControls.WebParts;
using System.Xml;

public partial class Weather : System.Web.UI.UserControl
{
protected int _HttpTimeout = 30;
protected DateTime _InstallDate;
protected string _LicenseKey = "";
protected string _Location = "USGA0029;INXX0102;INXX0130";
protected bool _ShowDetails;
protected bool _Units = false;
public static string licenseInfo = "";
protected void Page_Load(object sender, EventArgs e)
{
weathercontrol();
}
protected void weathercontrol()
{
string str = "";
string str2 = "";
int num = 1;
string str3 = this._LicenseKey;

if (num == 0)
{
}
else
{
if (!string.IsNullOrEmpty(this._Location))
{
string[] strArray2 = this._Location.Split(new char[] { ';' });
string str4 = "f";
if (this._Units)
{
str4 = "c";
}
foreach (string str5 in strArray2)
{
string key = "YahooWeather" + str5 + str4;
string str7 = null;
try
{
str7 = (string)HttpContext.Current.Cache[key];
}
catch (Exception exception)
{
Label1.Text=("Cache Fetch Error:" + exception.Message);
}
if (str7 == null)
{
try
{
HttpWebRequest request = (HttpWebRequest)WebRequest.Create("http://weather.yahooapis.com/forecastrss?p=" + str5 + "&u=" + str4);
request.Timeout = this._HttpTimeout * 0x3e8;
WebResponse response = request.GetResponse();
StreamReader reader = new StreamReader(response.GetResponseStream());
str7 = reader.ReadToEnd();
reader.Close();
response.Close();
}
catch (Exception exception2)
{
Label1.Text=("Error accessing the Yahoo weather service:" + exception2.Message);
return;
}
try
{
HttpContext.Current.Cache.Add(key, str7, null, DateTime.Now.AddHours(1.0), Cache.NoSlidingExpiration, CacheItemPriority.Normal, null);
}
catch (Exception exception3)
{
Label1.Text=("Cache Add Error:" + exception3.Message);
}
}
try
{
XmlDocument document = new XmlDocument();
document.LoadXml(str7);
XmlNodeList list = document.SelectNodes("rss/channel/item/title");
string innerText = "";
string str9 = "";
foreach (XmlNode node in list)
{
innerText = node.InnerText;
if (innerText.StartsWith("Conditions for"))
{
innerText = innerText.Substring(14);
}
int index = innerText.IndexOf(" at");
if (index > 0)
{
str9 = innerText.Substring(index + 4);
innerText = innerText.Remove(index);
}
}
XmlNodeList list2 = document.SelectNodes("rss/channel/item/link");
string str10 = "";
foreach (XmlNode node2 in list2)
{
str10 = node2.InnerText;
}
string attribute = "";
foreach (XmlElement element in document.GetElementsByTagName("yweather:units"))
{
attribute = element.GetAttribute("temperature");
}
string str12 = "";
foreach (XmlElement element2 in document.GetElementsByTagName("yweather:condition"))
{
str12 = element2.GetAttribute("code");
}
string str13 = "";
string str14 = "";
if (this._ShowDetails)
{
foreach (XmlElement element3 in document.GetElementsByTagName("yweather:atmosphere"))
{
str13 = element3.GetAttribute("humidity");
}
foreach (XmlElement element4 in document.GetElementsByTagName("yweather:wind"))
{
str14 = element4.GetAttribute("speed");
}
}
string str16 = str + "<table border=0 cellpadding=2 cellspacing=0 width='20%'>";
//str = ((str16 + "<tr bgcolor=#f3f3f3><td colspan=2><strong><a href='" + str10 + "' target=_blank>" + innerText + "</a></strong></td>") + "<td align=right><font color=#2797C7>" + str9 + "</font></td></tr>") + "<tr bgcolor=#bcbcbc height=1><td colspan=3></td></tr>" + "<tr bgcolor=#fbfbfb>";
str = ((str16 + "<tr bgcolor=#f3f3f3><td colspan=3><strong>" + innerText + " </strong></td>") + "</tr>") + "<tr bgcolor=#bcbcbc height=1><td colspan=3></td></tr>" + "<tr bgcolor=#fbfbfb>";


foreach (XmlElement element5 in document.GetElementsByTagName("yweather:condition"))
{
str = str + "<td valign=top width=110 align=center style='border-right:1px dotted #D0D0D0;color:#808080'><br />";
string strimage = "http://l.yimg.com/a/i/us/we/52/" + str12 + ".gif";

str = str + "<img src='" + strimage + "'><br />";


//str = str + "<img src='" + this.Page.ClientScript.GetWebResourceUrl(base.GetType(), "WeatherWebpart.Gif." + str12 + ".gif") + "'><br />";
str16 = str;
str = str16 + "<span style='font-size:14pt; font-family:arial,helvetica; line-height:18pt; color:#333333; font-weight:bold'>" + element5.GetAttribute("temp") + "°" + attribute + "</span><br />";
str = str + "<span style='color:gray'>" + element5.GetAttribute("text") + "</span>";
if (this._ShowDetails)
{
str = str + "<br />Humidity:" + str13 + "%";
str = str + "<br />Wind:" + str14 + " mph";
}
str = str + "</td>";
}
//foreach (XmlElement element6 in document.GetElementsByTagName("yweather:forecast"))
//{
// str = str + "<td width=110 valign=top align=center style='border-right:1px dotted #D0D0D0'>";
// string str15 = element6.GetAttribute("day").Replace("Sun", "Sunday").Replace("Mon", "Monday").Replace("Tue", "Tuesday").Replace("Wed", "Wednesday").Replace("Thu", "Thursday").Replace("Fri", "Friday").Replace("Sat", "Saturday");
// str = str + "<font color=#808080><b>" + str15 + "</b></font><br />";
// string strimage = "http://l.yimg.com/a/i/us/we/52/" + element6.GetAttribute("code") + ".gif";
// str = str + "<img src='" + strimage + "'><br />";

// //str = str + "<img src='" + this.Page.ClientScript.GetWebResourceUrl(base.GetType(), "WeatherWebpart.Gif." + element6.GetAttribute("code") + ".gif") + "'><br />";
// str16 = str;
// str = str16 + "<span style='font-size:8pt; line-height:12pt; color:black; font-weight:bold'>" + element6.GetAttribute("low") + "°" + attribute + ".." + element6.GetAttribute("high") + "°" + attribute + "</span><br />";
// str = str + "<span style='color:gray'>" + element6.GetAttribute("text") + "</span>";
// str = str + "</td>";
//}
str = str + "</tr></table><br/>";
}
catch (Exception exception4)
{
Label1.Text=("Error parsing the Yahoo XML document:" + exception4.Message);
return;
}
}
}
else
{
str = "Please specify a location";
}

Label1.Text = str;
//if (str2 != "")
//{
// Response.Write("<br>" + str2);
//}
}
}
}