Won't run against an Issue Tracking list

Jul 2, 2012 at 2:49 PM

It gives an error stating it may only be run against a list or library.

Seems to work perfectly against task lists, but I'm trying to use this against an Issue Tracking list, (that's got lots of other workflows running against it - so migrating to another list would be a huge task).

Any help massively appreciated!

thanks

Jul 2, 2012 at 8:50 PM

Hi Dave,

I will have to look into that and make a code change.  I don't know you if downloaded the source code or not, but below is where that check is happening:

//Get the attachments
if ((myList.BaseType == SPBaseType.GenericList))
{
     attachments = GetListItemAttachments(myItem);
}
else if ((myList.BaseType == SPBaseType.DocumentLibrary))
{
     attachments = GetDocumentFromLibrary(myItem);
}
else
{
     throw new ArgumentException("Invalid list type. Send email with attachment will only work with Lists or Document Libraries.");
}

Looking at this, it seems that an Issue Tracking list SPBaseType is not a GenericList.  I will make the modifications as soon as I can, but it will be a couple of days.

Jul 2, 2012 at 9:05 PM

This should be a pretty easy fix. Looking at the BaseTypes from http://msdn.microsoft.com/en-us/library/microsoft.sharepoint.spbasetype.aspx the Issue tracking list has it's own BaseType of SPBaseType.Issue.

The fix could be as simple as adding an "Or" to the first statement, but I will have to test it and be sure.

Coordinator
Jul 3, 2012 at 3:00 AM

I have added an updated version to the download section.  I have made it the default download.  You will have to retract the current version and deploy the new version.

Thanks for reporting this.

Jul 3, 2012 at 7:59 AM

Matt - your assistance, and swift reply, is enormously helpful and really appreciated! Got us out of a big hole.

Going to try again today.

Forgot to add that the functionality of being able to send from a different email address is also really, really good - had I known about it, it would have saved us a couple of days of work.

Jul 3, 2012 at 1:59 PM

Hi Matt again! - tried to use it, but as I was publishing the workflow, I got the following message: "(0, 10) The type or namespace name 'SPD_SendEmailWithAttachment' could not be found (are you missing a using directive or an assembly reference?)"

We retracted the current version and redeployed. Do you think we missed something?

thanks

Dave

Jul 3, 2012 at 6:43 PM

I am working on this now. 

Were you using version 2 before or the orginal version? Also did you activate the feature in the web application settings?  Not sure if that is the problem or not, but just a thought.

Jul 3, 2012 at 7:04 PM

Hi Dave,

I ran through a test.  I deployed version 2 and created a workflow, then retracted version 2 and deployed the new version.  After I deployed the new version I didn't activate it in the web application settings and went to publish the workflow again.  I got the error you are seeing.  Going back to central administation and activating the solution for the web application I was then able to deploy it.

Thanks,

Matt

Jul 3, 2012 at 7:28 PM

once again, many many thanks! We think we did activate it in Central Admin, but will check again.

We'll deploy to another server to see what happens, if we still get an error.

thanks

Jul 3, 2012 at 8:20 PM
Edited Jul 3, 2012 at 8:24 PM

Just let me know.

The other possible problem is the web.config file.  When you activate the solution it adds a line in the web.config file for the web application and when you retract the solution it removes the line that is entered.

It could be that for some reason this is not being updated when deploying the new solution.  The part that is updated is in the <authorizedTypes> section. You should see the following line:

<authorizedType Assembly="SPD_SendEmailWithAttachment, Version=1.0.0.0, Culture=neutral, PublicKeyToken=acc221d0a4a7db74" Namespace="SPD_SendEmailWithAttachment" TypeName="*" Authorized="True" />

I would check to make sure that line is there and also that it is not duplicated.

If you want you can email me directly and I can send you my contact information and I can try to help further. To email me, just view my profile and click the contact link.

Jul 3, 2012 at 9:29 PM

Guess what? It only bloody works! Yipppeedddy...... time for a stiff drink.

Thanks again.

Jul 4, 2012 at 4:23 AM

I am glade to hear it!

Let me know if there is anything else I can do.

Mar 30, 2014 at 5:41 AM
Thank you so much Mattj28, the suggested solution works. i was able to fix the error quickly.