• About Ken
  • Ken’s CV

All About SharePoint

~ Liedong(Ken) Zheng, Independent SharePoint Consultant

All About SharePoint

Monthly Archives: April 2009

Importing Custom Active Directory attributes into User Profiles‏

28 Tuesday Apr 2009

Posted by ken zheng in Sharepoint

≈ 4 Comments

Tags

Sharepoint

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

Advertisements

Automatic Login SharePoint for authenticated ADS user

28 Tuesday Apr 2009

Posted by ken zheng in Sharepoint

≈ 2 Comments

Tags

Sharepoint

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.

DocumentExplorer WebPart Extenstion

24 Friday Apr 2009

Posted by ken zheng in Sharepoint

≈ Leave a comment

Tags

Sharepoint, webpart

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.

24-04-2009-4-30-23-pm1

You can download the source from here.

Incompatible Web Part markup detected. Use “.dwp web part XML instead of *.webpart web part xml

23 Thursday Apr 2009

Posted by ken zheng in Sharepoint

≈ 2 Comments

Tags

Sharepoint

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…

Add other fields (properties) to the Search results.

17 Friday Apr 2009

Posted by ken zheng in Sharepoint

≈ 1 Comment

Tags

User Profile

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

Upgrade: Transition Your MCPD Enterprise Application Developer Skills to MCPD Enterprise Application Developer 3.5

16 Thursday Apr 2009

Posted by ken zheng in .Net

≈ Leave a comment

Tags

MCP, MCPD

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)

MOSS: SPListItem.Update() throws error Operation is not valid due to the current state of the object.

03 Friday Apr 2009

Posted by ken zheng in Sharepoint

≈ 5 Comments

Tags

Sharepoint

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;

    }


Get Count from SharePoint List for InfoPath

03 Friday Apr 2009

Posted by ken zheng in Sharepoint

≈ Leave a comment

Tags

InfoPath, Sharepoint

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;
        }

Pages

  • About Ken
  • Ken’s CV

Blog Stats

  • 1,607,340 hits

.Net 3.5 5566 AJAX BCS BDC C# Calendar Content Type CSS Custom Page Document ID Fast Search favicon Feature IIS InfoPath infopath form JavaScipt JavaScript jQuery LINQ Listview Managed Property Master Page MCP MCPD migration MOQ MySite Page Layout PowerShell Proxy Search Search Scope SharePoiint 2010 SharePoiint 2010; Search SharePoin Sharepoint Sharepoint 2007 SharePoint2007 Sharepoint 2010 Sharepoint Search Silverlight Site Collection Site Definition Site Master Page site templates SPDisposeCheck SPD workflow SPSiteDataQuery SPUser SQL SSP stored procedure STSADM survey Tab TechEd Tech ED TSQL User Profile User Profiles Synchronization Service;SharePoint 2010 vs 2008 vs 2010 vs2010 WCF web.config webpart Web Part Web Service windbg workflow XML XSL XSLT

Archives

  • March 2016
  • April 2014
  • March 2014
  • February 2014
  • December 2013
  • October 2013
  • September 2013
  • March 2013
  • February 2013
  • August 2012
  • June 2012
  • May 2012
  • April 2012
  • February 2012
  • January 2012
  • December 2011
  • November 2011
  • October 2011
  • September 2011
  • August 2011
  • July 2011
  • June 2011
  • May 2011
  • April 2011
  • March 2011
  • February 2011
  • January 2011
  • December 2010
  • November 2010
  • October 2010
  • September 2010
  • August 2010
  • July 2010
  • June 2010
  • May 2010
  • April 2010
  • March 2010
  • February 2010
  • January 2010
  • December 2009
  • November 2009
  • October 2009
  • September 2009
  • August 2009
  • July 2009
  • June 2009
  • May 2009
  • April 2009
  • March 2009
  • February 2009
  • January 2009
  • December 2008
  • November 2008
  • October 2008
  • September 2008
  • August 2008
  • July 2008
  • June 2008
  • May 2008
  • April 2008
  • March 2008
  • February 2008
  • January 2008

Twitter Updates

  • @Nintex just wonder if there is any SharePoint online workflow server issue right now? All workflows are not reachable 7 months ago
  • @yarratrams Hi My boy lost his Camberwell Grammar Balzer on Tram 75 yesterday 16/05/17 around 4:30. He got off at Warrigal road, 11 months ago
  • SharePoint Online Workflow Service Failed Today! 12 months ago
  • Follow the latest news on the Tour #TDF2016 bit.ly/29TNYBl 1 year ago
  • @katushacycling @Kristoff87 1 year ago
Locations of visitors to this page

Blogroll

  • E-books Library
  • My Linkedin
  • SharePoint Community
  • SharePoint Developer Center
  • Silverlight Show
April 2009
M T W T F S S
« Mar   May »
 12345
6789101112
13141516171819
20212223242526
27282930  
Advertisements

Create a free website or blog at WordPress.com.

Cancel