Pages

Showing posts with label Sharepoint Problems. Show all posts
Showing posts with label Sharepoint Problems. Show all posts

Tuesday, January 26, 2010

ERROR: Workflow failed on start

I was getting below error while starting of workflow.

Workflow:System.Workflow.ComponentModel.Compiler.WorkflowValidationFailedException: The workflow failed validation.     at System.Workflow.Runtime.WorkflowDefinitionDispenser.ValidateDefinition(Activity root, Boolean isNewType, ITypeProvider typeProvider)     at System.Workflow.Runtime.WorkflowDefinitionDispenser.LoadRootActivity(Type workflowType, Boolean createDefinition, Boolean initForRuntime)     at System.Workflow.Runtime.WorkflowDefinitionDispenser.GetRootActivity(Type workflowType, Boolean createNew, Boolean initForRuntime)     at System.Workflow.Runtime.WorkflowRuntime.InitializeExecutor(Guid instanceId, CreationContext context, WorkflowExecutor executor, WorkflowInstance workflowInstance)     at System.Workflow.Runtime.WorkflowRuntime.Load(Guid key, CreationContext

I spend lots of time to find out exact resolution for workflow failed error, but I couldn’t get solution, below are some of the reference link which talks causing of issue due to migration from visual studio 2005 to 2008 workflow project, but in my case, I have created workflow into visual studio 2008 only, some articles were talking about adding some line into solution project, but that’s also not working for me.

Reference Link:

http://blog.hhebnes.no/?tag=/workflows

http://www.eggheadcafe.com/software/aspnet/31975863/sharepoint-workflow-upgra.aspx

http://geekswithblogs.net/SoftwareDoneRight/archive/2007/12/12/condition-not-found.aspx

At the last for resolving my issue, I have created new workflow file, one thing I have observed here – if I am going to change main default file name for workflow file from workflow.cs to something else, then sometime it will mess up workflow. So I would recommend not changing workflow.cs file name.

:)

SPWorkflow AlterTask didn’t work with hash table which has space into key name

While creating hash table for passing into altertask method, we need to be very careful, because it didn’t like spaces into key name, we need to put our key without spaces.

Sample Code:

taskHash["UserInputField"] = UserInputField.Text;

taskHash["UserInputField_ForHash"] = UserInputField.Text;

taskHash["Status"] = "Completed";

taskHash["Status_ForHash"] = "Completed";

SPWorkflowTask.AlterTask(taskListItem, taskHash, true);

Reference Link:

http://www.databaseforum.info/10/1131769.aspx

ERROR: The security validation for this page is invalid. Click Back in your Web browser, refresh the page, and try your operation again

I was getting above error while doing altertask on SPWorkflowTask.AlterTask method.

Solution:  we need to write altertask code under SPSecurity delegate and need to write code for Allowunsafeaccess.

http://sansanwal.blogspot.com/2009/08/security-validation-for-this-page-is.html

http://support.microsoft.com/default.aspx?scid=kb;EN-US;970192

ERROR: The content type of a workflow task must be derived from the Workflow Task content type

I was getting “The content type of a workflow task must be derived from the Workflow Task content type” error while working with custom ASPX form for visual studio workflow, I have created custom content type which will be used into workflow, I have found out that my content type ID is incorrect by comparing it with some another content type ID. Visual studio activity “Createtaskwithcontenttype” must be inherited from workflow task.

Reference Links:                                

http://www.eggheadcafe.com/software/aspnet/30858987/login.aspx

http://social.msdn.microsoft.com/Forums/en-US/sharepointworkflow/thread/93679b02-bfa9-43c2-94ad-ec45191cd478

Tuesday, December 15, 2009

ERROR: Cannot override the Shared Resource Provider context obtained from the Office Server. This API can be used only when an Office Server context is either internally unavailable or defined

I was getting above error while working with BDC object model; actually I have custom code which will interact with SQL Session Provider instance and try to open SSP database.

Code

SqlSessionProvider.Instance().SetSharedResourceProviderToUse(“SSPName”);

I have found out that I need to change my custom code to work properly to remove error, I got very good reference from http://blogs.msdn.com/syedi/archive/2009/05/28/populating-the-bdc-field-of-a-splistitem-from-client-application.aspx link, which provided me BDC object model code with example.

Thank you!

ERROR: The type or namespace name 'ApplicationRegistry' does not exist in the namespace 'Microsoft.Office.Server' (are you missing an assembly reference)

I was working with BDC object model and accessing BDC application definition file from my custom ASPX page, I have included correct assembly for 'ApplicationRegistry' class but still it was giving me above error, after sometime I have realized that actually it’s looking for different assembly name to be included into page.

i.e. Microsoft.SharePoint.Portal (in microsoft.sharepoint.portal.dll).

After adding Microsoft.SharePoint.Portal assembly into page, I didn’t get any error :)

 Good Job!

SharePoint Timer Job ERROR: This job will be skipped. Failed to connect to an IPC Port: Access is denied.

I got timer job error into my virtual machine when I was running timer job by stsadm command –execadmsvcjobs

Solution:

In my case, my ‘Windows SharePoint Services Timer' service was running with normal user account, I need to changed user credentials have system account which has access to database also.

 Reference Link:

 http://ari-techno.blogspot.com/2009/08/job-failed-with-following-error-this.html

Friday, December 11, 2009

How to stop event handler recursion

I was getting errors into event log when I was trying to update list in which I have written event handler code and again that code was executed from event receiver only, so it goes in loop, sometimes my page becomes very slow.

Solution:

I need to write code which will disabled event firing before when I was trying to update something into same list and then I need to enable event firing after my code.

SAMPLE CODE:

this.DisableEventFiring();

objtem.SystemUpdate(false);

this.EnableEventFiring();

Reference Links:

 

http://www.sharepoint-tips.com/2006/10/preventing-event-handler-recursion.html

Thank you!

How to impersonate user into event receiver class or Access denied error on event receiver

Requirement:

I need to remove user permission from list item based on some specified condition; normal user don’t have rights to remove user level permission, so I need to put my business logic into RunWithElevatedPrivileges delegate into event receiver class, but I was facing some challenges after that also, normal user was getting access denied errors while breaking inheritance of list item into event receiver class.

Solution:

We need to be very careful while writing impersonation code into event receiver, because if we miss one class or object to take reference from current logged in user then code won’t work, in my case – I was taking List Item on current logged in user context, I need to be very specific for taking List Item. Key here is needs to take list item by SPListItem objItem = elevatedWeb.Lists[properties.ListId].GetItemById(properties.ListItem.ID);

 

SAMPLE CODE:

 

SPSecurity.RunWithElevatedPrivileges(delegate()

            {

                using (SPSite elevatedSite = new SPSite(properties.SiteId))

                {

                    using (SPWeb elevatedWeb = elevatedSite.OpenWeb(properties.RelativeWebUrl))

                    {

                        SPListItem objItem = elevatedWeb.Lists[properties.ListId].GetItemById(properties.ListItem.ID);

  objItem.Web.AllowUnsafeUpdates = true;

                                objItem.BreakRoleInheritance(false);

                            objLeaseItem.Web.AllowUnsafeUpdates = true;

}

                    }

                });

Reference Links:

http://social.msdn.microsoft.com/forums/en-US/sharepointdevelopment/thread/f2ccd61a-8828-4c17-8360-20d45d6b9514

http://social.msdn.microsoft.com/Forums/en-US/sharepointdevelopment/thread/c3d2b304-7fcc-40d2-86ce-61d9b21b03d7  

http://boris.gomiunik.net/2009/04/spsecurityrunwithelevatedprivileges-and-access-denied-error-on-event-receiver/  

Good Luck!

Friday, May 29, 2009

Error occurred while starting of workflow (Could not load file or assembly Load Workflow Assembly System.IO.FileNotFoundException)

I was so frustrated to resolved above workflow error, because when I deployed my visual studio workflow solution package and started the workflow (manually or item created) then I was getting error in workflow status as “Failed on Start (retrying)”, also I didn’t see much useful information into workflow history, after looking into SharePoint log file, I have found below error.

Error:

Could not load file or assembly Load Workflow Assembly: System.IO.FileNotFoundException: Could not load file or assembly ‘ABC.dll, Version=1.0.0.0, Culture=neutral, PublicKeyToken=xxxxxxxxxxx' or one of its dependencies.
I know that there was some problem into feature.xml or workflow.xml file into solution package, but after looking into details, I have found out that I made very silly mistake into workflow.xml file, there was one tag called “CodeBesideAssembly”, we need to write only assembly name like ABC into that tag, but I wrote ABC.dll into CodeBesideAssembly tag into workflow.xml file which caused the error while starting of workflow.

After removing extra DLL word from the file, my workflow was worked fine. So be careful while making workflow.xml file.

Keep Sharing…

Sunday, May 10, 2009

SharePoint Designer (SPD) Workflow deployment

One day I have very tough requirement, my requirement was to deploy my SharePoint designer workflow from development server to TEST server, I tried to find solutions from the internet but didn’t get any easy way for my requirements, at the last I have found one very good link which fulfill my requirements, though it requires some manual steps as describes in below link.

But now I can replicate same designer workflow to target server with some or more manual changes, I know that it’s very painful at some level to do manual steps, but we can say that it’s possible to deploy SPD workflow to other machine with manual effort ….

There is no direct way to copy designer workflow from one server to another server. Only thing which we can do is through “site template” also.

We need to save our SharePoint site as template in which we have created the workflow from SharePoint designer and using that template we can create a new site on another server which will have same workflow attached with it.

Here is link which describes manual steps to deploy designer workflow.

http://www.sharepointblogs.com/andynoon/archive/2007/09/18/reparenting-a-workflow-to-a-different-list.aspx

Enjoy working!!

Wednesday, May 6, 2009

Challenges while working with object model to access recurring meeting workspace site information

I was faced many challenges while getting all agenda list, document library from recurring meeting workspace site, because when we are accessing recurring meeting workspace into object model by SPList and other object, we are only getting data of first meeting instance ID, we are not able to loop through all instance at one place.

 

Many of the people were facing same problem like me, here is one of the link http://www.eggheadcafe.com/forumarchives/Sharepointwindowsservices/Aug2005/post23625925.asp

 

I did lots of search on internet and finally I found one line of code from which I got some direction to work on. I followed this link to find my solution, http://www.eggheadcafe.com/forumarchives/Sharepointwindowsservicesdevelopment/Sep2005/post23663884.asp

 

Points to be taken care:
1. There is one hidden list called “Meeting Series” into object model, which will store all the meeting Instance ID, so we need to take each meeting Instance ID from hidden list

 

2. We need to pass meeting Instance ID to SPQuery object, SPQuery contains property to hold Meeting Instance ID.

 

Sample Code to find out all data from recurring meeting workspace site:

 

        //Check if current Web is Meeting Workspace then execute below code

        if (SPMeeting.IsMeetingWorkspaceWeb(oWeb))

        {

            //Get Meeting Series list for taking Instance ID of each workspace site

            SPList meetingSeriesList = oWeb.Lists["Meeting Series"];

 

            for (int Cnt = 0; Cnt < meetingSeriesList.Items.Count; Cnt++)

            {

                int InstanceId = Convert.ToInt32(meetingSeriesList.Items[Cnt]["InstanceID"]);

 

                if (InstanceId != 0)

                {

                    // Use SPQuery to set Meeting Instance ID

                    SPQuery MeetingQry = new SPQuery();

                    MeetingQry.IncludeMandatoryColumns = true;

                    MeetingQry.MeetingInstanceId = InstanceId;

 

                    //Do Processing of SPQuery Object and get all Agenda List, Document Library data                  

                }

            }

         }

Tuesday, May 5, 2009

Limitation of SharePoint Designer(SPD) Workflow

SharePoint Designer is good tool to start initial or basic level workflow, I am not expert and good person to point out any limitation into any software, but as per me below are some of the limitation which I felt for SharePoint Designer Workflow, I’ll also write you more description about some of the limitation in coming posts …

  1. We don’t have facility to send BCC email to any person from “Send an Email” actions.

  2. We can’t bind and attach more then one list into designer workflow, though there are some manual steps from where we can fulfill our requirements, but there won’t be any easy steps from interface or GUI

  3. We can’t deploy/copy our designer workflow from one server to another server like there won’t be any easy way to deploy SPD workflow from development machine to TEST and Production Server; I’ll write how to do manual steps to achieve this functionality. here is my post regarding how to deploy designer workflow ...

  4. Designer Workflow don’t give us full customized editor from where we can customized our email body text, to do this, we need to write static HTML tags into email body part.

  5. We don’t write any calculation fields or formulas into Designer Workflow actions items, like I can’t extract only date from date-time column into designer workflow interface, for this I need to take one extra column into my SharePoint list and need to manipulate into designer workflow.

  6. While working in “Send an Email” action, if we add any list column from adding “Add Lookup to Body” button and if that column don’t have any values into SharePoint list, then it’s shows as ?????? instead of blank values into email body while sending emails …


I’ll update above lists as per my experience with designer workflow.

Thursday, March 19, 2009

Challenges and limitation while saving list as template from SharePoint GUI

I have found some limitation when I was tried to create new list from existing list template from SharePoint GUI, suppose we have 2 list and one list has lookup column associated with second list column, now we are saving or exporting both list as template and including content to migrate both list from one server to another server, when we are creating new list from saved template, at that time, we are not able to see lookup column values into first list and we are getting error “One or more field types are not installed properly. Go to the list settings page to delete these fields


 



Resolution:

I need to go into first list and again map lookup column from second list column, because while migrating list from SharePoint GUI, it didn’t keep column relationship mapping. By using 3rd party tool like AvePoint for list migration, we won’t face such type of error. We can also write custom code to migrate list from one server to another server.

Friday, March 13, 2009

Data view web part – rich HTML text problems/output caching

While working in Data View web part, I have placed user name column into my data view web part, but by default, it displayed some rich text HTML into page, in this case, we need to disable output caching for web part, so for this, we need to put disable-output-escaping="yes" tag into XSL.

 



e.g. <xsl:value-of select="@fieldname" “disable-output-escaping="yes">

 



Problem with "doctype" column name into SharePoint List

I was faced problem with column name “doctype”, I was not able to create “doctype” column with any of the data type into SharePoint List, and I was getting “Unknown error” into my page when I tried to create column. I tried to find the solution on the internet for some time, but I didn’t get good information, I believe that “doctype” column name is reserved for internal purpose, so we can’t use same name like ID, title column name.


 


Luckily I was able to create “doctype” as single line of text data type, now the actual problem started, I was not able to delete “doctype” column from SharePoint list, definitely we can write custom code and delete same column from code. But I have found easy way to delete “doctype” column from going to tool called “SharePoint Manager 2007” and I have selected my site-> list -> “doctype” column and delete from that tool. You can find more information regarding SharePoint manager 2007 from my blog, here is link http://sanketinfo.wordpress.com/2008/10/15/sharepoint-manager-2007-%e2%80%93-administration-tool/


 


Now if we have requirements to create “doctype” into list, then we can create same column name by changing character case. “doctype” column name is case-sensitive, like we can create column with named “DocType”

Thursday, November 20, 2008

Value does not fall within the expected range error while check-in of document

I was getting error while check-in of document from document library into SharePoint interface. Actually I have created Meta data fields and attached to document, I was able to check-in document from office application like word, but if I check-out and check-in same document from document library interface then I was getting error "Value does not fall within the expected range".

I tried looked into event log, but didn't find any good information then I found below error from SharePoint Logs.

Error into log file:

Application error when access /_layouts/Checkin.aspx, Error=Value does not fall within the expected range.   at
Microsoft.SharePoint.SPFieldCollection.GetFieldByInternalName(String strName, Boolean bThrowException)     at
Microsoft.SharePoint.SPFieldCollection.GetFieldByInternalName(String strName)     at Microsoft.SharePoint.SPListItem.get_MissingRequiredFields()     at
Microsoft.SharePoint.ApplicationPages.Checkin.OnLoad(EventArgs e)     at System.Web.UI.Control.LoadRecursive()     at
System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) 

Solution:

By looking at the error, I thought that issue was only because of meta fields column name and as we know internal name and display name is different for each column, I also found on the internet regarding same error saying that its because of  misspell name attribute into schema.xml file.

Then by looking and comparing each field I have found out that, by mistaken I added one extra equal(=) to end of my field name, by correcting my column name, my problem gets resolved and was able to successfully check-in document from SharePoint interface also.

SharePoint Logs – Tracing service lost trace events

Some time, my SharePoint logging didn’t work properly for some reason, if I looked into my SharePoint Logs directory then in every generated log file, I have found below lines.

Date and time        wsstracing.exe        (0x07E4) 0x1634         ULS Logging  Unified Logging Service uls1        Monitorable              Tracing Service lost trace events.           Current value 8.

Solution:

I need to restart my logging service, SharePoint uses "Windows SharePoint Services Tracing" service for writing logs into ULS logs, so I went to services and restarted my "Windows SharePoint Services Tracing" services, once I did that, a new logs was created into SharePoint logs file. I also found out that might be this errors showed due to upgrade of service pack 1.

Tuesday, November 18, 2008

Crawling of PDF document from SharePoint search

I had issue while crawling of our SharePoint sites, I was getting error for the outlook message file in which there were embedded PDF document.

Errors which I was getting into crawl log:
1. The filtering process could not be initialized. Verify that the file extension is a known type and is correct
2. Error HRESULT E_FAIL has been returned from a call to a COM component.

I have found on the internet that I have to install extra filter into server which will search and crawl for PDF files, there are 2 free filters available. One is from Adobe Ifilter 6.0 and one from Foxit Filter.

I tried to play with both filter but I was getting error into PDF and message file, I know, I was missing in some little configuration and installation of something.

At the last, I have found one very good and important link, as per that link, Adobe has not created any separate iFilter for PDF file types after Adobe Reader 7 version.

So they suggested us to installed Adobe Reader 8 or reader 9 version into our server, because after reader 7, Adobe package iFilter functionality into same software as plugs-in.

So after doing configuration from below links, I got the success, now I am able to crawl message file and PDF documents from the SharePoint sites.

MAIN IMPORTANT LINK:

http://nhmn.com/blogs/pointedman/PointedPost/08-05-21/How_to_Correctly_Configure_pdf_i-Filter_for_SharePoint_2007.aspx?ReturnURL=%2fblogs%2fpointedman%2fPointedPost%2f08-05-02%2fSharePoint_SSPScopeDeploy_for_MOSS_launched.aspx&BlogTagID=7249c096-182f-4abb-9420-ea7a21659377

Good Reference Links.

http://www.adobe.com/support/downloads/detail.jsp?ftpID=2611&promoid=DNRLI (all about Adobe PDF IFilter v6.0) 

http://www.adobe.com/support/downloads/product.jsp?product=1&platform=Windows (Different products from Adobe)

http://blog.tylerholmes.com/2008/04/walkthrough-installing-adobe-v6-pdf.html ( How to install Adobe filter)

http://downloads.fuxinsoftware.com.cn/pub/foxit/manual/enu/FoxitPDFIFilter10forMOSS_manual.pdf (Manual for Foxit Filter)

Tuesday, November 4, 2008

Conflict into SharePoint version

One time, I had problem while installation of MOSS 2007, my installation was corrupted due to some problem, so I was not able to repaired, every time I was getting error when I run “SharePoint Products and Configuration Wizard” from the interface.

I find the below solution, If we run below psconfig command from command prompt then will able to install SharePoint successfully without any version confliction.

C:\Program Files\Common Files\microsoft shared\Web Server Extensions\12\BIN>
psconfig -cmd upgrade -inplace b2b -wait -force

SharePoint Products and Technologies Configuration Wizard version 12.0.6217.1000
Copyright (C) Microsoft Corporation 2005. All rights reserved.

Performing configuration task 1 of 4
Initializing SharePoint Products and Technologies upgrade...

Successfully initialized SharePoint Products and Technologies upgrade.

Performing configuration task 2 of 4
Initiating the upgrade sequence...

Successfully initiated the upgrade sequence.

Performing configuration task 3 of 4
Upgrading SharePoint Products and Technologies...

Successfully upgraded SharePoint Products and Technologies.

Performing configuration task 4 of 4
Finalizing the SharePoint Products and Technologies configuration...

Successfully completed the SharePoint Products and Technologies configuration.

Total number of configuration settings run: 4
Total number of successful configuration settings: 4
Total number of unsuccessful configuration settings: 0
Successfully stopped the configuration of SharePoint Products and Technologies.
Configuration of the SharePoint Products and Technologies has succeeded.