Copy link to clipboard
Copied
I need to know why i am getting this error. Sample UID from exchange...
1 | <7a1c300c-1b95-48ae-9ff9-1dbfaa143972@casnysm95baap.nysemail.nyenet> |
2 | <f143e6e8-82b7-4d39-a730-6ca5955c0f84@casnysm95bafp.nysemail.nyenet> |
----------------
Error:
Element UID is undefined in DISTINCTVALUES. | |
The error occurred in C:\inetpub\wwwroot\test0\exchange.cfm: line 37 | |
35 : 36 : <cfoutput query="distinctvalues"> 37 : <cfexchangeMail action="delete" connection="myExchangeConnection" uid="#distinctvalues.uid#"> 38 : </cfoutput> |
--------------------
<cfexchangemail action="get" name="spamMail" connection="myExchangeConnection" folder="Junk E-mail">
<cfexchangefilter name="fromID" value="search@cio.ny.gov">
</cfexchangemail>
<cfquery
dbtype="query" name="distinctvalues" >
SELECT lower(uid) as myid
FROM spamMail
</cfquery>
<cfdump
var="#distinctvalues#">
 
<cfoutput query="distinctvalues">
<cfexchangeMail action="delete" connection="myExchangeConnection" uid="#distinctvalues.uid#">
</cfoutput>
Copy link to clipboard
Copied
Well, ask yourself this question:
Does the column UID exist in distinctValues?
No.
Why not?
Have a look at the QoQ you use to create distinctValues. Do you see any mention of UID in there? Yep. But are you returning a column called UID in that query? No. You are changing its name to myid.
--
Adam
Copy link to clipboard
Copied
I changed that...but still same error
UID not found. | |
The error occurred in C:\inetpub\wwwroot\test0\exchange.cfm: line 37 | |
35 : 36 : <cfoutput query="distinctvalues"> 37 : <cfexchangeMail action="delete" connection="myExchangeConnection" uid="#distinctvalues.myid#"> 38 : </cfoutput> |
Copy link to clipboard
Copied
Nooo, that's not the same error, is it?
First error:
Element UID is undefined in DISTINCTVALUES.
Second error:
UID not found.
Different.
So what is the error telling you? You're passing a UID to Exchange and asking it to delete that record for you. Exchange is telling you "UID not found".
I suspect it has something to do with you lower-casing you UIDs. CF might be case-insensitive (except, like in situations where it is a minimal wrapper for Java functionality like QoQ, as you have discovered), but Exchange might not be. So a UID of "abc" might not be the same as a UID of "ABC".
OR... it could be a symptom of CF's Exchange support being pretty... um... "lacking in polish", shall we say. Be before condemning CF, what happens if you do NOT lower case your UIDs?
--
Adam
Copy link to clipboard
Copied
same error with removing lower. Same thing works when I delete messages from inbox but not junk folder.
Copy link to clipboard
Copied
Looking at your code: you're querying the UIDs from the junk-items folder but trying to delete them from the default folder. That's not going to work (as you have just found out). You need to tell Exchange that you mean "from the junk-items folder".
--
Adam
Copy link to clipboard
Copied