Posted by ken zheng on April 28, 2009
Wonder if anyone across this problem and have any idea. We have created a couple attributes in AD but they are not showed in Data source field to map in Edit User Profile Property after I did full import.
I finally figure it out, first go to Search Setting and to see if it is in the Managed Properties. Also check to see if there are duplicated property in user profile. You may have to delete existing one and recreate in User Profile
Posted in Sharepoint | Tagged: Sharepoint | Leave a Comment »
Posted by ken zheng on April 28, 2009
1) Go to Internet Explorer options.
2) Add the SharePoint site to the Trusted Location.
3) Go to Custom Level and scroll to last option and change it Automatic logon with current username and password.
4) You may also do it for Intranet Zone if required.
Posted in Sharepoint | Tagged: Sharepoint | Leave a Comment »
Posted by ken zheng on April 24, 2009
Atidan Document Explorer for SharePoint is a tree-view control that displays your Microsoft® SharePoint site’s document library structure and content in the familiar explorer type view.
Document libraries and associated contents are presented in an intuitive, collapsible, hierarchical format.
The is a great control, but the problem is it displays all document libraries under site. Because it is using User Control and no property to set. So I decide to extend the web part which allow user specify the document library.

You can download the source from here.
Posted in Sharepoint | Tagged: Sharepoint, webpart | Leave a Comment »
Posted by ken zheng on April 23, 2009
Check for [XmlRoot(Namespace = "ClassNameSpace")] in top of ur class definition, remove this statement and deploy again and see what happens. I got the same error mentioned and when I remove the above statement it works fine with me…
Posted in Sharepoint | Tagged: Sharepoint | 2 Comments »
Posted by ken zheng on April 17, 2009
I have followed this blog to add new field to th search results.
There is one thing you need to be careful if the field is the property from profile. Open the property from Shared Service ->User Profiles and Properties ->View profile properties->Edit. Make sure you ticked the “Replicable” check box in the Policy Settings which will allow the property displays in the result list
Posted in Sharepoint | Tagged: User Profile | Leave a Comment »
Posted by ken zheng on April 16, 2009
The exams for this path will became available in recent months:
• Exam 70-568: Upgrade: Transition Your MCPD Enterprise Application Developer Skills to MCPD Enterprise Application Developer 3.5, Part 1 (English)
• Exam 70-569: Upgrade: Transition Your MCPD Enterprise Application Developer Skills to MCPD Enterprise Application Developer 3.5, Part 2 (English)
Posted in .Net | Tagged: MCP, MCPD | Leave a Comment »
Posted by ken zheng on April 3, 2009
Problem:
When running SPListItem.Update commands inside SPSecurity.RunWithElevatedPrivileges block you get error: Operation is not valid due to the current state of the object.
Thoughts:
I will call this a workaround since I don’t know why it works and is this really how it should be done.
Workaround:
You must not call the SPListItem.Update inside the RunWithElevatedPrivileges block. Instead you should only instantiate the SPSite or SPWeb there and call Update afterwards, like this:
private static string CreateSiteLink(SPWeb newSite, int groupId, string text)
{
string retVal = "";
SPWeb elevatedRootWeb = null;
try
{
SPSecurity.RunWithElevatedPrivileges(delegate()
{
using (SPSite elevatedSite = new SPSite(newSite.Site.ID))
{
elevatedRootWeb = elevatedSite.RootWeb;
}
});
SPList userInformation = elevatedRootWeb.Lists["User Information List"];
if (userInformation != null)
{
try
{
elevatedRootWeb.AllowUnsafeUpdates = true;
SPListItem item = userInformation.GetItemById(groupId);
if (item["Notes"] != null)
{
item["Notes"] = string.Format(text, newSite.ServerRelativeUrl, newSite.Name);
item.Update();
}
elevatedRootWeb.AllowUnsafeUpdates = false;
}
catch (Exception e)
{
retVal = " Site link for group " + groupId + " couldn't be created. (" + e.Message + ")";
}
}
else
{
retVal = " Site link for group " + groupId + " couldn't be created. (User Information List not found)";
}
finally
{
elevatedRootWeb.Dispose();
}
return retVal;
}
Posted in Sharepoint | Tagged: Sharepoint | 3 Comments »
Posted by ken zheng on April 3, 2009
I always be asked to get a Numberic Id for new infopath form. Instead of writing code in Form, I created a Web Service which will go to the SharePoint List, grab the number and increment by 1, then update the list. By doing that, you can set rule in your Form Submit Button without code required.
Below is the code
[WebMethod]
public int GetAndIncrementCount(string ListUrl, string CountName)
{
int count = 0;
SPWeb oSPWeb = null;
try
{
SPSecurity.RunWithElevatedPrivileges(delegate()
{
using (SPSite oSPSite = new SPSite(ListUrl))
{
oSPWeb = oSPSite.OpenWeb(ListUrl.Substring(ListUrl.IndexOf("/") + 1));
}
});
SPList oSPList = oSPWeb.GetList(ListUrl);
if (oSPList != null)
{
oSPWeb.AllowUnsafeUpdates = true;
SPListItemCollection items = oSPList.Items;
if (items.Count > 0)
{
SPListItem item = items[0];
count = int.Parse(item[CountName].ToString()) + 1;
item[CountName] = count;
item.Update();
}
}
}
catch (Exception exception)
{
Log.WriteLogEvent(string.Format("An Error Occured In GetAndIncrementCount Method | Exception Message:{0} StackTrace: {1}", exception.Message, exception.StackTrace));
}
finally
{
oSPWeb.Dispose();
}
return count;
}
Posted in Sharepoint | Tagged: InfoPath, Sharepoint | Leave a Comment »