Logo 
Search:

Sharepoint Forum

Ask Question   UnAnswered
Home » Forum » Sharepoint       RSS Feeds

Deadline Alerts on Lists

  Asked By: Abhilasha    Date: Jan 02    Category: Sharepoint    Views: 1767

I'm trying to find out a way of accessing list information and
sending out e-mail alert notifications when due dates are coming up
in the next 2 days, using a console application which will hopefully
run daily as a scheduled task. The mail alerts will be sent to an
address specified in one of the list columns.

I thought the way I should do this is either through WSS web
services or through the object model. I'm struggling to dynamically
instantiate web service connections - as I have to iterate through
subsites to find them, and am not sure if I can connect to the web
services dynamically. If so, any ideas on how to do this would be
helpful.

I have written the following code to try and access the information
using the object model, which I'm sure isn't perfect, but it won't
get past the first line, I get a file not found error on the url. -
The site is on the same server as I'm running the code from.



SPSite siteCollection = new SPSite("http://spinstall/");
for (int i = 0; i < siteCollection.AllWebs.Count; i++)
{
SPWeb titleSite = siteCollection.AllWebs[i];
SPWeb brandSite = titleSite.Webs["Brand Area"];
SPWeb assetSchedule = brandSite.Webs[0];
SPList assets = assetSchedule.Lists["Asset Schedule"];
foreach (SPListItem li in assets.Items)
{
if (Convert.ToDateTime(li.Fields["Modified Date"]) <= DateTime.Today
&& li.Fields["Completed"].ToString() != "Completed")
Console.WriteLine(li.Fields["Title"].ToString() + " -
Overdue!");
else
Console.WriteLine(li.Fields["Title"].ToString() + " - Not
Overdue!");
}
}

Share: 

 

2 Answers Found

 
Answer #1    Answered By: Cristopher Gould     Answered On: Jan 02

I think I could do it using Web Services but I would
prefer to use the Object Model, and I was running  the console  applicaiton on
the same machine as Sharepoint. In the mean time I tried to create a
workflow with a delay and an e-mail  notification to create a remider, when I
try and install the workflow as a feature I am getting the following
message:

The farm is unavailable

I think maybe this is why I'm having problems with the OM too, but don't
understand why. I'm running sharepoint 2003 and 2007 on the same machine,
with the portal upgraded to 2007 and the original sites connecting back to
2003. I don't know if its something to do with this install that is causing
the problem?

 
Answer #2    Answered By: Ryan W     Answered On: Mar 10

This post gives a few link that may help - console  app, workflow, custom timer job etc.

stackoverflow.com/.../dated-reminders-in-sharepoint-calendars

For your specific problem
- Is "File not found" the error  message or is it something more like "The server  instance specified was not found"?
- are you sure that url  is correct?
- can you do things like STSADM -o enumsites -url http://spinstall
- verify the Alternate access  mappings,
- can you access that url from a browser running  on the server
- Are you using http or https and is it default ports (in WSS2 there are all sorts of weird bugs that depending on http/s)

technet.microsoft.com/en-us/library/cc288252.aspx

All else failing I would try and get a test/dev server setup (perhaps using VMWare/Virtual PC) with a clean install of WSS3 to (2007) to try your code  on - eliminate the chance that your 2003/2007 setup is causing problems.

Good luck!...Ryan

 
Didn't find what you were looking for? Find more on Deadline Alerts on Lists Or get search suggestion and latest updates.




Tagged: