in

SharePoint Blogs

The Best Place for SharePoint-related Blogs

Blog for Sharepoint Hunter

A (un)managed bag of ideas, tricks, gripes about New Emerging Technologies
  • .NET Framework 3.5 and Infopath compatibility issue

    Itay has reported this issue and i had same issue with my development environment.

    Request failed.

    System.Security.SecurityException: Request failed.
    at Microsoft.SharePoint.Administration.SPPersistedObject.ToString()
    at Microsoft.SharePoint.SPSite..ctor(SPFarm farm, Uri requestUri, Boolean contextSite, SPUserToken userToken)
     

     http://www.infopathdev.com/forums/p/7535/27677.aspx
    The reason why this environment failed is due to Code Access Security.  By default a DLL accessing the SharePoint OM will fail on the SharePoint side, unless you modify the given trust levels beyond their scope, create your own, or use the Full trust level.  Another way around the problem would be to install the assembly into the GAC (C:\Windows\assembly), which would require strongly naming the DLL.  None of these options should be taken lightly, so be sure to dive into CAS before deciding to go with any of these paths.  Also, you can look at CAS as it applies to InfoPath here: http://msdn2.microsoft.com/en-us/library/aa944687(VS.80).aspx. Finally, i digged into this problem and resolved by follow the below steps.To allow the form template's business logic to call this member when it is being debugged or previewed, you must set your form template's security level to Full Trust as described in the following procedure.

    Configuring a Managed Code Form Template that Requires Full Trust
    Set your form's security level to Full Trust
    1. If you are working in InfoPath, open the form template in design mode.
    If you are working in Visual Studio, open the InfoPath Form Template project, and then click the manifest.xsf [Design] tab to display the form designer.
    1. On the Tools menu, click Form Options.
    2. In the Category list, click Security and Trust.
    3. Under Security Level, clear Automatically determine security level.
    4. Select Full Trust, and then click OK.
  • MOSS 2007 Customization Best Practices

    Microsoft had released a set best practices for many common types of customizations Microsoft SharePoint Products and Technologies.

    Check it out SharePoint Products and Technologies Customization Best Practices  - Interesting one!!!… 

    ·         SharePoint Database Schema Change

    ·         SharePoint Database Access

    ·         Modifying Built-In SharePoint Files

    ·         Web Services Access

    ·         SharePoint Designer Editing

    ·         SharePoint Solution

    ·         SharePoint Feature

    ·         Feature Stapling

    ·         Feature Event Receiver

    ·         Windows Server Service

    ·         Timer Job

    ·         Web Application

    ·         Web Service

    ·         Site Definition

    ·         List Definition

    ·         Site Template

    ·         List Template

    ·         Field Type

    ·         Content Type

    ·         Column Template or Site Column

    ·         Delegate Control

    ·         Form Template

    ·         Custom Action

    ·         _Layouts Page

    ·         Event Handler

    ·         Backward-Compatible Event Handler

    ·         Coded Workflow

    ·         No Code Workflow

    ·         Workflow Activity

    ·         Workflow Condition

    ·         Web Part

    ·         SharePoint Theme

    ·         Document Icon

    ·         IFilter

    ·         Document Converter

    ·         Information Management Policy

    ·         Business Data Catalog Application Definition File

    ·         Excel Services User-Defined Function

    ·         InfoPath Form Custom Code

    ·         InfoPath Form View Control

    ·         HTTP Handler

    ·         HTTP Module

    ·         Pluggable Authentication Provider

    ·         Pluggable Single Sign-On Provider

    ·         STSADM Command Extension

    ·         Inline Code

    ·         web.config file Settings Change

    ·         Security Policy

     

  • MOSS 2007 Service Pack 1 Installation Experience

    We installed first time in a stressy condition the SP1 for a development server (a simple farm installation). In the middle of installation, it is starts behaving like a stranger and finally get craped! The result: Server error http://go.microsoft.com/fwlink?LinkID=96177 when trying to access one of the sites. I tried to sync old content database, but no luck. After requesting an and applying Windows Sharepoint Services 3.0 hotfix 936867 our Sharepoint stopped working completely. I've found the following error messages in the application log: In simple, the schema versions of content databases are not consistent between DB Server and MOSS Server as follows

    “The schema version (3.0.149.0) of the database SharePoint_AdminContent_0015a5e2-8907-416d-8672-940a68c2c431 on Database Server is not consistent with the expected database schema version (3.1.3.0) on MOSS Server.  Connections to this database from this server have been blocked to avoid data loss.  Upgrade the web front end or the content database to ensure that these versions match”

    Problem:

    Event Type:     Error
    Event Source:     Windows Sharepoint Services 3
    Event Category: Topology
    EventID:     5617
    Date:          
    03.25.2008
    Time:         
    20:45:34
    User:          
    N/A
    Computer:  MOSS Server
    Description: 
    The schema version (3.0.149.0) of the database SharePoint_AdminContent_0015a5e2-8907-416d-8672-940a68c2c431 on Database Server is not consistent with the expected database schema version (3.1.3.0) on MOSS Server.  Connections to this database from this server have been blocked to avoid data loss.  Upgrade the web front end or the content database to ensure that these versions match

    Solution:
    called "stsadm -o upgrade -inplace -url http://{central_admin_url}/"

    example., stsadm –o upgrade –inplace –url http://mossserver:17492/

     

    That seemed to have solved the problem.
  • MOSS 2007 Content Deployment Options Comparison

    One of the interesting question has been raised in most of discussion fourms is Deployment Options Comparison and which is the best way to deploy and pros/cons. Here's the small comparison between all the deployment options. Also, i would like to recommend MOSS 2007 Deployment Wizard tool. The SharePoint Content Deployment Wizard is a tool for SharePoint 2007 which provides the means to deploy the following content:

    - site collections
    - webs
    - lists
    - folders
    - list items (including files)

    Content is exported using the Content Migration API (PRIME) as a .cmp file (Content Migration Package) which can be copied to other servers for import. Unlike the out-of-the-box tools, the Wizard allows *granular* selection of content via a treeview. You can download the tool from www.codeplex.com/SPDeploymentWizard 

    Comparison between all the deployment options

      STSADM Content Deployment Content Migration API Features Deployment
    Description Uses STSADM commands to generate a file (export) which can then be transferred to the target for import.  One of the simplest ways of moving content from one place to another, although unlikely to be suitable as a continuous deployment mechanism.

    Examples:
    stsadm.exe -o export -url http://localhost -filename C:\Export.cab -includeusersecurity -versions 4 -overwrite

    stsadm.exe -o import -url http://localhost/sites/newsite -filename C:\Export.cab -includeusersecurity

    Configured via 'Content Deployment paths and jobs' in Central Admin ('/_admin/deployment.aspx'). A path defines the source/target and authentication details, specific jobs define exactly which content should be deployed and how often. Quick deploy functionality allows users with permissions to specify important content which should be deployed more regularly than existing job schedules configured by administrators (quick deploy items are deployed every 15 mins).

     

    Involves writing code which uses the content migration API (known as PRIME) to export then import content - the API is easy to use.

     

     

     

     

     

     

    Involves defining XML configuration files which SharePoint uses to add artifacts in the correct way on the target. This can be significantly more complex than simply developing in SharePoint Designer but can allow for better management throughout a solution's lifecycle.

     

     

     

     

    Good for 1. Moving an entire site/web as a one off

    2. Quick deployment tests

    3. Reparenting webs (can be into a different site collection)
    1. Moving entire site collections/webs on a scheduled basis e.g. in an authoring/production or authoring/staging/production topology
     
    2. Deploying only incremental changes, e-mail notifications of success/failures

    3. Allowing site owners to have some control over content deployment via Quick Deploy

    4. Automatically deploying dependencies of content selected for deployment, even if in different site (e.g. page layouts/content types/site columns/referenced images etc.) 

    5. Automatically transferring the deployment package to the target environment (via HTTPSleep)
    Not transactional
    1. Complete flexibility over deployment options
    Granular control over what gets deployed (down to item level)

    2. Ability to preserve object GUIDs (so that list GUIDs do not need to fixed-up)

    3. Ability to select options for security, versioning and user roles
    1. Iterative development/deployment
    Deployment of assemblies and filesystem files (none of the other methods deal with this)

    2. Ability to deploy assemblies/filesystem files to all servers in a farm with Solution packages

    3.Possibilities for continuous integration 
    Considerations 1. Content on target will be overwritten if already exists

    2. Granularity down to web only

    3. Object GUIDs are not preserved (so some things will need to be 'fixed up' e.g. anything that references a list by GUID - ListViewWebPart, using lists with InfoPath forms) 

    4. Not a backup/restore tool - although it's the option which is most like backup/restore, things like alerts, audit trail, recycle bin items, security state, workflow tasks/state are not exported

    5. Not transactional
    1. Content on target will be overwritten if already exists

    2. Granularity down to web only

    3. No differentiation between site content (e.g. pages/images) and site 'infrastructure' (e.g. master pages, page layouts)

    4. Object GUIDs are preserved
    Blank site template should be used for source and destination (see http://support.microsoft.com/kb/923592)

    5. Also not a backup/restore tool (see above)
    1. Blank site template should be used for source and destination (see http://support.microsoft.com/kb/923592)

    2. Not transactional
    Also not a backup/restore tool (see above)

    3. Need development skills to write code
    1. Developer is responsible for evaluating and deploying dependencies (e.g. underlying content types).
     
    2. Updates to content types, list definitions, site columns etc. deployed via a Feature  must be done with the API - modifying original Feature files and then reprovisioning is not supported

    3. Can be very time-consuming due to lack of assistance from current tools

     

  • Forms Services being taken down for maintenance

    We're experiencing with the following issue since last couple weeks. I've tried to figure out the root cause of problem and post it in MSDN Forums as follows:-http://forums.microsoft.com/MSDN/ShowPost.aspx?PostID=2796881&SiteID=1&mode=1 - Finally, I digging into server farm and found that Server Farm has been Quiesced by someone - Here's the small summary of it;

    Problem 

    Error

    "The server is currently being taken down for maintenance. Check with your system administrator to see when this server is scheduled to come back online. Click Try Again to attempt to load the form again. If this error persists, contact the support team for the Web site. Click Close to exit this message." (Image shown in the attached document)

    Cause of the problem:

    The server farm has been Quiesced (Image shown in the attached document)

    Solution:

    Go to Central Administrator->Operations->Global Configuration-> Quiesce Farm and Click ‘Reset farm’ (Image shown in the attached document)

     

  • Export BDC(Business Data Catalog) Data to Excel

    One of the down parts in Business Data Catalog is lack of export the data. Also, most of the folks expecting this functionality as following thread. http://forums.microsoft.com/TechNet/ShowPost.aspx?PostID=2201460&SiteID=17.

    The solution is writing an HttpHandler to do the job. The nice thing about using the HttpHandler approach is that it pretty much did one thing for me: it took care of transforming the data into a format that Excel can open.How I actually gathered my data was a task that could be offloaded to some other data access component in the application, and the differentiating query values could be retrieved by using QueryString property variables. Using QueryString property variables makes reusing the solution quite easy. I've create an GenericInvoker MethodInstance to fetch the records as follows

     

            <Method Name="ExportPlants">

              <Properties>

                         ……..

                </Parameter>

              </Parameters>

              <MethodInstances>

                <MethodInstance Name="ExportToExcel" Type="GenericInvoker" ReturnParameterName="ExportPlantsExcel"/>

              </MethodInstances>

            </Method> 

            protected override void CreateChildControls()

            {

                lbExcel = new HyperLink();

                lbExcel.Text = "Export To Excel";

                lbExcel.NavigateUrl = SPContext.Current.Web.Url + @"/Export.ashx?format=excel&instance=ExcelInstance";

                lbExcel.Load += new EventHandler(lbExcel_Load);

                lbExcel.ImageUrl = "/_layouts/images/ICXLS.GIF";

     

                lbPdf = new HyperLink();

                lbPdf.Text = "Export To PDF";

                lbPdf.Load += new EventHandler(lbPdf_Load);

                lbExcel.NavigateUrl = SPContext.Current.Web.Url + @"/Export.ashx?format=pdf&instance=PDFInstance";

                lbExcel.ImageUrl = "/_layouts/images/pdf.gif";

               

                    ….

            }

     

    Session object has hold the object result from GenericInvoker MethodInstance

            /// <summary>

            /// Holds PDF Instance

            /// </summary>

            /// <param name="sender"></param>

            /// <param name="e"></param>

            void lbPdf_Load(object sender, EventArgs e)

            {

                System.Web.HttpContext.Current.Session["PDFInstance"] = BdcHelpers.ExecuteGenericInvoker(lobSystemInstance, entityName, "ExportToExcel");

            }

     

            /// <summary>

            /// Holds Excel Instance

            /// </summary>

            /// <param name="sender"></param>

            /// <param name="e"></param>     

            void lbExcel_Load(object sender, EventArgs e)

            {

               System.Web.HttpContext.Current.Session["ExcelInstance"] = Helpers.ExecuteGenericInvoker(lobSystemInstance, entityName, "ExportToExcel");

            }

            /// <summary>

            /// Overloads Execute Method for MethodInstance of specified LOBSystem

            /// </summary>

            /// <param name="lobSystemInstance">LOB System</param>

            /// <param name="entityName">Name Of an Enity</param>

            /// <param name="methodInstance">GenericInvoker Method Instance Name</param>

            /// <returns>Object</returns>

            public static Object ExecuteGenericInvoker(string lobSystemInstance, string entityName, string methodInstance)

            {

                NamedLobSystemInstanceDictionary instances = ApplicationRegistry.GetLobSystemInstances();

                LobSystemInstance instance = instances[lobSystemInstance];

                Entity entity = instance.GetEntities()[entityName];

     

                MethodInstance methInst = entity.GetMethodInstances()[methodInstance];

     

               return entity.Execute(methInst, instance);

            }

    Finally, you have to register your handler as follows

        <httpHandlers>

          <remove verb="GET,HEAD,POST" path="*" />

          <add verb="*" path="Export.ashx" type="BDCWebParts.ExportHandler, BDCWebParts" />

        </httpHandlers>

     

    Hope this helps!

  • Best Practices of MOSS 2007 Hosting(Upgrade)

    As we know, there are three main ways to perform an upgrade to Office SharePoint Server 2007:

    • In-place upgrade
    • Gradual upgrade
    • Database attach

    I used each of the three strategies in different scenarios. However, we overwhelmingly favored gradual upgrade and database attach due to the quantities of sites and data involved, in addition to the large number of users affected.So, I would like to recommend the following best practices for deployment of an Office SharePoint Server 2007 solution within an enterprise. In some cases, deploying the solution without following these suggestions is possible, but this may result in unnecessary expense or effort.

    1. Perform a thorough audit of all products and platforms that the upgrade may affect, including Windows Server, SQL Server, IIS, Windows SharePoint Services, and prior versions of SharePoint Products and Technologies, in addition to portals, sites, and content.
    2. Make sure that level settings are consistent across the environment to be upgraded.
    3. Identify and install missing language packs. Doing so during the upgrade itself is inefficient and can cause problems.
    4. Schedule and analyze prescans by using the prescan tool (Prescan.exe) at least two days before each upgrade.
    5. Upgrades can fail for a variety of reasons. Have a contingency plan in place in case minor or major roadblocks occur.
    6. Determine the priority of exceptions and to what degree they will be allowed to affect the schedule. Communicate this information to affected users.
    7. Schedule, perform, and confirm backups before performing upgrades. Ensure that backups and upgrades are not scheduled to run at the same time, because this will cause upgrade failure.
    8. In performing a database attach, the number of sites is the most important factor in how long the upgrade will take. If many sites exist on a farm, schedule upgrades based on the number of sites. If there are fewer sites (as may be the case with team and portal sites), schedule them based on the quantity of data.
    9. Define the upgrade process thoroughly before sending communications about the schedule and process. Not doing so will confuse end users and may encourage them to think the schedule is negotiable.
    10. Perform a dry run whenever feasible. Identifying and fixing problems beforehand will increase the likelihood of maintaining the schedule after the upgrade begins.
    11. Do not avoid testing because of limited hardware resources. Use virtual machines for testing if excess hardware capacity is not available.
    12. Data requirements usually grow during an upgrade; exceeding the capacity of a database will cause the upgrade to fail. Increase the target databases to appropriate sizes before the upgrade process and set databases, temporary databases, and log files to autogrow.
    13. Watch for upgrade problems caused by full-text search. Moving the SQL Server database to a different server or disabling full-text search on the SQL Server computer can mitigate the impact.
    14. Do not finalize the upgrade until you are sure the upgrade is finished. Finalizing the upgrade removes the connection to the previous version and deletes any temporary data, and it is irreversible.

     

    Hope this helps!

  • Power of SharePoint Team Collaboration

    I got a chance to work with one of the top 5 fortune company for re-design of their intranet portal. I'd like to share this project experiences and power of sharepoint team collaboration with you folks - We worked in conjunction with one of the top 5 fortune company's IT to re-design their intranet portal, the company's enterprise intranet portal. The design was based on well-researched employee needs and business goals and implemented using the latest release of SharePoint Portal Server 2007.

    The key areas of improvement in their intranet portal included development of new capabilities for:

    1. Improve the ability to find and retrieve the "right" information
    2. Information workers were confused by too many choices for storing content
    3. Teams needed common collaborative processes to work effectively together.
    4. Supporting multiple storage and collaboration platforms was expensive and complex for IT.

    Employees who used previous versions of their Web found it difficult to find the right amount of current, relevant, and authoritative information in the diverse and fast changing environment of their intranet. Four key problems related to finding the right information:

    • It took too long to find the "right" information. This was often described in terms of taking too many mouse clicks to find useful information or not being able to find the right information after spending considerable effort searching and navigating the intranet.
    • It was hard to locate information and knowledge that was relevant in the context of the immediate task for an employee to complete his or her work. For example, search results often included too much unrelated information to be useful.
    • It was difficult for an employee to know when they could rely on information they found on the intranet. It was also difficult to ascertain whether that information was timely, accurate and complete.
    • Employees found it difficult to know the best keyword choices to use for searching because of the large number of acronyms, technical terms, project code names and product names in regular use at their organization.

    One of the best solution to find the right information(i.e., reduce the number of mouse clicks) is provide a custom search based on their custom content type(which is inherited from **Document** contenttype)

      Ex: http://forums.microsoft.com/TechNet/ShowPost.aspx?PostID=1881103&SiteID=17
  • MOSS 2007 SP1 Would be Release On December 11th

    Microsoft SharePoint product Team has decided/set the MOSS SP1 Release for December 11th. This is not a guaranteed but for informational purposes as we know that if any issues may arise from here till then it could be push back.  Hopefully, this service pack would solve major issues which is in current versions.

     

    UPDATE: As mentioned ealier in my posts, Microsoft has released SP1 on Dec 11th. Here's the download links!

    Service Pack 1 Resource Center: http://technet.microsoft.com/en-us/office/sharepointserver/bb735839.aspx 

    WSS 3.0 SP1: http://www.microsoft.com/downloads/details.aspx?FamilyId=4191A531-A2E9-45E4-B71E-5B0B17108BD2&displaylang=enMicrosoft Office Servers 2007 SP1: http://www.microsoft.com/downloads/details.aspx?FamilyId=AD59175C-AD6A-4027-8C2F-DB25322F791B&displaylang=en 

    If you are running Language Packs there are also updates for 32-bit and 64-bit versions:

    32-bit: http://www.microsoft.com/downloads/details.aspx?FamilyID=3A6C26FD-0BEB-40D5-8CBA-15164FAAB150&displayLang=en
     
    64-bit: http://www.microsoft.com/downloads/details.aspx?FamilyID=56681742-7D2C-4A6F-9178-DACD32AADC6C&displayLang=en

     

    Hope this helps!

  • Close New Opened Infopath form automatically

    I'd a situation as subject stated. I've to close the infopath form(opened in a new window) after the form has been submited sucessfully. As aware, if it's being open in a same window, we can achive this task by mentioning "Source" element in the Url. BUT, If it's opend in a new window, no use of specifing "Source" element with Url. So, we need to do some workaround for this problem.

    Here's my solution/workaround for it:-

    1. Create a html page called ("WindowClose.htm)

    2. Copy and paste the following code snippet and save it under "C:\Program Files\Common Files\Microsoft Shared\web server extensions\12\TEMPLATE\LAYOUTS" folder

    <html>
    <head>
    <script language="javascript">
    function closewindow() {
    self.opener = this;
    self.close();
    }
    </script>
    </head>
    <body onload="closewindow();">
    </body>
    </html>

    3. Now, specify this file as source in your url. i.e.,

    http://[myserver]/_layouts/FormServer.aspx?XsnLocation=/FormServerTemplates/TestForm.xsn&Source=/_layouts/windowclose.htm&DefaultItemOpen=1&PersonalInfoID=196

    4. Test your application by open/submit an infopath form in a new window

    In real time scenario, We've been facing this kind of issues in BDC with Infopath form. From BDC, users can search and they would like to modify the record in a new window using Infopath, user has to close the form once they done their job. To avoid these head ache, we can make use of above work around.

    Hope this helps!

  • Best Practices in Javascript Library Design

    Last night, I'd the chance to look at John Resig's talk on the Best Practices in Javascript Library Design.

                    This talk explores all the techniques used to build a robust, reusable, cross-platform JavaScript Library. We’ll look at how to write a solid JavaScript API, show you how to use functional programming to create contained, concise, code, and delve deep into common cross browser issues that you’ll have to solve in order to have a successful library. John Resig is a JavaScript Evangelist, working for the Mozilla Corporation, and the author of the book ‘Pro Javascript Techniques.’ He’s also the creator and lead developer of the jQuery JavaScript library and the co-designer of the FUEL JavaScript library (included in Firefox 3).

    1. jQuery - that simplifies how you traverse HTML documents, handle events, perform animations, and add Ajax interactions to our web pages.
    2. Fuel - Firefox User Extension Library - is a JavaScript Library designed to help developers build extensions using terminology and interfaces that are familiar to them. It will be usable in Firefox 1.5-3.0.

    Download jQuery