Posted by ken zheng on October 22, 2008
If you encounter an error of type “Error 102 An object of the type Microsoft.SharePoint.Administration.SPSolution named “SolutionPackageName” already exists under the parent Microsoft.SharePoint.Administration.SPFarm named “SharePointContentDBName”. Rename your object or delete the existing object”, then even though if you remove the references of the solution in the sites, SharePoint will not allow to redeploy the solution.
The issue can be solved by, browse to the Central Administration -> Operations -> Solution Management and then delete the wsp file that caused the error and then redeploy the file again.
or run
%stsadm% -o retractsolution -name sharepointrandomimagewebpart.wsp -url “http://app01:17768/sites/infoservice” -immediate
wait a minute then run
%STSADM% -o deletesolution -name sharepointrandomimagewebpart.wsp
Posted in Sharepoint | Tagged: Add new tag, solution | 3 Comments »
Posted by ken zheng on October 22, 2008
Please keep in mind, that if it is not updated, all items which require a date time stamp reference will be out by 1 hour.
If necessary, time zone information for Sharepoint can be manually updated, as per the following KB:
http://support.microsoft.com/kb/888253
This involves editing the timezone.xml file, located at
C:\Program Files\Common Files\Microsoft Shared\Web Server Extensions\12\CONFIG
Example
In the following example, the end time for daylight savings is set to the first week in April, and the start time for daylight savings is set to the first week in October.
Note that the section refers to the week in the month. If this is set to 5, that means the last week.
<TimeZone ID="76" Name="(GMT+10:00) Canberra, Melbourne, Sydney" Hidden="FALSE">
<Bias>-600</Bias>
<StandardTime>
<Bias>0</Bias>
<Date>
<Month>4</Month>
<Day>1</Day>
<Hour>3</Hour>
</Date>
</StandardTime>
<DaylightTime>
<Bias>-60</Bias>
<Date>
<Month>10</Month>
<Day>1</Day>
<Hour>2</Hour>
</Date>
</DaylightTime>
</TimeZone>
Posted in Sharepoint | Tagged: daylight savings | Leave a Comment »
Posted by ken zheng on October 22, 2008
Here is the simple custom webpart which random displays the image from picture library.
You can edit the web part by change the URL and picture library name

public class RandomImage : System.Web.UI.WebControls.WebParts.WebPart
{
string _SiteURL = SPContext.Current.Web.Url;
string _PicLibName = "Pic Lib";
[WebBrowsable(true),
Personalizable(PersonalizationScope.Shared),
FriendlyName("The Site URL of Picture Library")]
public string SiteURL
{
get
{
return _SiteURL;
}
set
{
_SiteURL = value;
}
}
[WebBrowsable(true),
Personalizable(PersonalizationScope.Shared),
FriendlyName("The Name of Picture Library")]
public string PicLibName
{
get
{
return _PicLibName;
}
set
{
_PicLibName = value;
}
}
Image myimage = new Image();
protected override void CreateChildControls()
{
myimage.Height = 256;
myimage.Width = 256;
try
{
using (SPSite mysite = new SPSite(SiteURL))
{
//mysite = SPControl.GetContextSite(Context);
using (SPWeb myweb = mysite.OpenWeb())
{
SPList mylist = myweb.Lists[PicLibName];
SPQuery myquery = new SPQuery();
myquery.Query = "";
string serverpath = mysite.Url.ToString() + "/";
SPListItemCollection mylistitem = mylist.GetItems(myquery);
if (mylistitem.Count > 0)
{
System.Random RandNum = new System.Random();
int MyRandomNumber = RandNum.Next(mylistitem.Count);
myimage.ImageUrl = serverpath + mylistitem[MyRandomNumber].Url.ToString();
}
else
{
this.Page.Response.Write("No image found");
}
}
}
}
catch (Exception ex)
{
Controls.Clear();
Label errorMessage = new Label();
errorMessage.Text = "There was an error in the code. Please contact your system administrator and rely the following " +
"message: " + ex.Message;
Controls.Add(errorMessage);
}
base.CreateChildControls();
}
protected override void Render(HtmlTextWriter writer)
{
myimage.RenderControl(writer);
// TODO: add custom rendering code here.
// writer.Write("Output HTML");
}
}
Posted in Sharepoint | Tagged: Web Part | 2 Comments »