Showing posts with label SharePoint 2003. Show all posts
Showing posts with label SharePoint 2003. Show all posts
Friday, February 24, 2012
Tuesday, February 07, 2012
How to bind a Simple Dynamic HTML Table from SharePoint Links List
try
{
SPSecurity.RunWithElevatedPrivileges(delegate()
{
SPWeb currentWeb = SPContext.Current.Web;
SPList lstRecipeeLinks = currentWeb.Lists["Recipees Links"];
SPQuery sQuery = new SPQuery();
sQuery.Query = "<OrderBy><FieldRef Name='URL' /></OrderBy>";
sQuery.ViewFields = "<FieldRef Name='URL' />";
SPListItemCollection recipeeColl = lstRecipeeLinks.GetItems(sQuery);
if (recipeeColl.Count > 0)
{
writer.Write("<Table width='100%' cellpadding='0' cellspacing='0' border='1' borderColorDark='blue'>");
writer.Write("<Tr>");
writer.Write("<Td bgcolor='Blue' Colspan='2'>");
writer.Write("</Td>");
writer.Write("</Tr>");
writer.Write("<Tr>");
writer.Write("<Td style='font-size:x-small;font-weight:bold;' Align='Center' Colspan='2'>");
writer.Write("Indian Recipee Links");
writer.Write("</Td>");
writer.Write("</Tr>");
writer.Write("<Tr>");
writer.Write("<Td bgcolor='Blue' Colspan='2'>");
writer.Write("</Td>");
writer.Write("</Tr>");
int k = 1;
foreach (SPListItem item in recipeeColl)
{
string strLinkUrl = string.Empty;
string strLinkDescription = string.Empty;
SPFieldUrlValue strUrlValue = new SPFieldUrlValue(item["URL"].ToString());
strLinkUrl = strUrlValue.Url;
strLinkDescription = strUrlValue.Description;
writer.Write("<Tr>");
writer.Write("<Td width='5'>");
writer.Write(k);
writer.Write("</Td>");
writer.Write("<Td>");
writer.Write("<a href='" + strLinkUrl + "' target='_blank' style='font-size:x-small;color:Navy;text-Decoration:None;'>" + strLinkDescription + "</a>");
writer.Write("</Td>");
writer.Write("</Tr>");
writer.Write("<Tr>");
writer.Write("<Td bgcolor='Blue' Colspan='2'>");
writer.Write("</Td>");
writer.Write("</Tr>");
k++;
}
writer.Write("</Table>");
}
});
}
catch (Exception ex)
{
writer.Write(ex.ToString());
}
{
SPSecurity.RunWithElevatedPrivileges(delegate()
{
SPWeb currentWeb = SPContext.Current.Web;
SPList lstRecipeeLinks = currentWeb.Lists["Recipees Links"];
SPQuery sQuery = new SPQuery();
sQuery.Query = "<OrderBy><FieldRef Name='URL' /></OrderBy>";
sQuery.ViewFields = "<FieldRef Name='URL' />";
SPListItemCollection recipeeColl = lstRecipeeLinks.GetItems(sQuery);
if (recipeeColl.Count > 0)
{
writer.Write("<Table width='100%' cellpadding='0' cellspacing='0' border='1' borderColorDark='blue'>");
writer.Write("<Tr>");
writer.Write("<Td bgcolor='Blue' Colspan='2'>");
writer.Write("</Td>");
writer.Write("</Tr>");
writer.Write("<Tr>");
writer.Write("<Td style='font-size:x-small;font-weight:bold;' Align='Center' Colspan='2'>");
writer.Write("Indian Recipee Links");
writer.Write("</Td>");
writer.Write("</Tr>");
writer.Write("<Tr>");
writer.Write("<Td bgcolor='Blue' Colspan='2'>");
writer.Write("</Td>");
writer.Write("</Tr>");
int k = 1;
foreach (SPListItem item in recipeeColl)
{
string strLinkUrl = string.Empty;
string strLinkDescription = string.Empty;
SPFieldUrlValue strUrlValue = new SPFieldUrlValue(item["URL"].ToString());
strLinkUrl = strUrlValue.Url;
strLinkDescription = strUrlValue.Description;
writer.Write("<Tr>");
writer.Write("<Td width='5'>");
writer.Write(k);
writer.Write("</Td>");
writer.Write("<Td>");
writer.Write("<a href='" + strLinkUrl + "' target='_blank' style='font-size:x-small;color:Navy;text-Decoration:None;'>" + strLinkDescription + "</a>");
writer.Write("</Td>");
writer.Write("</Tr>");
writer.Write("<Tr>");
writer.Write("<Td bgcolor='Blue' Colspan='2'>");
writer.Write("</Td>");
writer.Write("</Tr>");
k++;
}
writer.Write("</Table>");
}
});
}
catch (Exception ex)
{
writer.Write(ex.ToString());
}
Sunday, January 29, 2012
No item exists at http://vlnrm:100/UserPages/QuerystringSample.aspx?ID=2. It may have been deleted or renamed by another user
You people can find the below error when writing an querystring within a WebPart even though the item Exists. To solve this don't use the querystring with the name ID, Use some other name then it will work fine.
Friday, December 02, 2011
How to set PDF Icon for a PDF file in Document Library in SharePoint Server
How to set PDF Icon for a PDF file in Document Library
- Copy the .gif file that you want to use for the icon to the following folder on the server, as appropriate for your version of SharePoint:
SharePoint Portal Server 2003 - Drive:\Program Files\Common Files\Microsoft Shared\Web Server Extensions\60\Template\Images
SharePoint Server 2007- Drive:\Program Files\Common Files\Microsoft Shared\Web Server Extensions\12\Template\Image
SharePoint Server 2010 - Drive:\Program Files\Common Files\Microsoft Shared\Web server extensions\14\Template\Images
- Stop IIS at a command prompt by running IISReset /stop
- Edit the Docicon.xml file to include the .pdf extension. To do this, follow these steps:
- Start Notepad, and then open the Docicon.xml file. The Docicon.xml file is located in one of the following folders on the server:
SharePoint Portal Server 2003 - Drive:\Program Files\Common Files\Microsoft Shared\Web server extensions\60\Template\Xml
SharePoint Server 2007- Drive :\Program Files\Common Files\Microsoft Shared\Web server extensions\12\Template\Xml
SharePoint Server 2010- Drive:\Program Files\Common Files\Microsoft Shared\Web server extensions\14\Template\Xml
- Add an entry for the .pdf extension. For example, add a line that is similar to the following to the Docicon.xml file, where NameofIconFile is the name of the .gif file:
<Mapping Key="pdf" Value="NameofIconFile.gif"/>
- On the File menu, click Save, and then quit Notepad.
- Start IIS at a command prompt by running IISReset /start
Subscribe to:
Comments (Atom)