Error the URL '' is invalid. When using ItemsUpdated in a photo libI'm trying to change the name of a file when a user Uploads an image using itemupdated.<br/> Look at the below:<br/> <br/> Before adding the try{}catch{}<br/> I was getting error :<br/> <br/> <strong>Save Conflict<br/> Your changes conflict with those made concurrently by another user. If you want your changes to be applied, click Back in your Web browser, refresh the page, and resubmit your changes. </strong> <br/> <br/> Now i get the error(When checking the file in):<strong><br/> <br/> The URL 'PhotoLib/interfaa.jpg' is invalid.  It may refer to a nonexistent file or folder, or refer to a valid file or folder that is not in the current Web</strong> <br/>  <br/>  public override void ItemUpdated(SPItemEventProperties properties)<br/>         {<br/>             //base.ItemUpdated(properties);<br/>             DisableEventFiring();<br/>             SPListItem doc = properties.ListItem;<br/>             //I had to use  AfterProperties because i needed to get the value from a dropDownlist before checking the file in unless its null<br/>             string sn = properties.AfterProperties[&quot;StoreName&quot;].ToString();<br/>             doc[&quot;Name&quot;] = String.Format(&quot;{0}_{1}&quot;, sn, sn);<br/>             try<br/>             {<br/>                 doc.Update();<br/>                 EnableEventFiring();<br/>             }<br/>             catch (SPException spEx)<br/>             {<br/>                 if (!spEx.Message.ToLower().Contains(&quot;save conflict&quot;))<br/>                 {<br/>                     throw spEx;<br/>                 }<br/>             }<br/>         }<br/> <br/> <br/> Sure i need to do something in my ItemUpdated event but still doing some research.<br/> Any ideas???<br/> <br/> <br/>© 2009 Microsoft Corporation. All rights reserved.Tue, 07 Jul 2009 00:48:10 Z74ae249f-c3e4-4513-b811-1ea4402580bahttp://social.msdn.microsoft.com/Forums/en-US/sharepointdevelopment/thread/74ae249f-c3e4-4513-b811-1ea4402580ba#74ae249f-c3e4-4513-b811-1ea4402580bahttp://social.msdn.microsoft.com/Forums/en-US/sharepointdevelopment/thread/74ae249f-c3e4-4513-b811-1ea4402580ba#74ae249f-c3e4-4513-b811-1ea4402580baPatrick.Ihttp://social.msdn.microsoft.com/Profile/en-US/?user=Patrick.IError the URL '' is invalid. When using ItemsUpdated in a photo libI'm trying to change the name of a file when a user Uploads an image using itemupdated.<br/> Look at the below:<br/> <br/> Before adding the try{}catch{}<br/> I was getting error :<br/> <br/> <strong>Save Conflict<br/> Your changes conflict with those made concurrently by another user. If you want your changes to be applied, click Back in your Web browser, refresh the page, and resubmit your changes. </strong> <br/> <br/> Now i get the error(When checking the file in):<strong><br/> <br/> The URL 'PhotoLib/interfaa.jpg' is invalid.  It may refer to a nonexistent file or folder, or refer to a valid file or folder that is not in the current Web</strong> <br/>  <br/>  public override void ItemUpdated(SPItemEventProperties properties)<br/>         {<br/>             //base.ItemUpdated(properties);<br/>             DisableEventFiring();<br/>             SPListItem doc = properties.ListItem;<br/>             //I had to use  AfterProperties because i needed to get the value from a dropDownlist before checking the file in unless its null<br/>             string sn = properties.AfterProperties[&quot;StoreName&quot;].ToString();<br/>             doc[&quot;Name&quot;] = String.Format(&quot;{0}_{1}&quot;, sn, sn);<br/>             try<br/>             {<br/>                 doc.Update();<br/>                 EnableEventFiring();<br/>             }<br/>             catch (SPException spEx)<br/>             {<br/>                 if (!spEx.Message.ToLower().Contains(&quot;save conflict&quot;))<br/>                 {<br/>                     throw spEx;<br/>                 }<br/>             }<br/>         }<br/> <br/> <br/> Sure i need to do something in my ItemUpdated event but still doing some research.<br/> Any ideas???<br/> <br/> <br/>Thu, 25 Jun 2009 06:23:54 Z2009-06-25T06:23:54Zhttp://social.msdn.microsoft.com/Forums/en-US/sharepointdevelopment/thread/74ae249f-c3e4-4513-b811-1ea4402580ba#3a4d2853-26da-48d8-bf4a-c216ceb11bfchttp://social.msdn.microsoft.com/Forums/en-US/sharepointdevelopment/thread/74ae249f-c3e4-4513-b811-1ea4402580ba#3a4d2853-26da-48d8-bf4a-c216ceb11bfcPeter Holparhttp://social.msdn.microsoft.com/Profile/en-US/?user=Peter%20HolparError the URL '' is invalid. When using ItemsUpdated in a photo lib<p>Hi Patrick,<br/><br/>The way you &quot;handle&quot; the non-wished exception is not ideal. The original exception is still there, although it is not shown up to the user interface.<br/><br/>You can try:<br/><br/>SPWeb web = properties.OpenWeb();<br/>SPSite site = web.Site;<br/><br/>web.AllowUnsafeUpdates = true;<br/>site.AllowUnsafeUpdates = true;<br/><br/>// do the job<br/><br/>web.AllowUnsafeUpdates = false;<br/>site.AllowUnsafeUpdates = false;<br/><br/>You should put the last two lines as well as the EnableEventFiring() in a finally block.<br/><br/>Peter<br/></p>Thu, 25 Jun 2009 08:13:11 Z2009-06-25T08:13:11Zhttp://social.msdn.microsoft.com/Forums/en-US/sharepointdevelopment/thread/74ae249f-c3e4-4513-b811-1ea4402580ba#b43763cf-6e64-471f-9c40-1309dc10d079http://social.msdn.microsoft.com/Forums/en-US/sharepointdevelopment/thread/74ae249f-c3e4-4513-b811-1ea4402580ba#b43763cf-6e64-471f-9c40-1309dc10d079Peter Holparhttp://social.msdn.microsoft.com/Profile/en-US/?user=Peter%20HolparError the URL '' is invalid. When using ItemsUpdated in a photo libWell, and at the end of the finally block you should call the base.ItemUpdated(properties) too.<br/><br/>A possible workaround is to use ItemUpdating (no need to call doc.Update() explicitly!), and set the<br/>properties.AfterProperties[&quot;Name&quot;] = String.Format(&quot;{0}_{1}&quot;, sn, sn);<br/>Call the base.ItemUpdating(properties).<br/><br/>PeterThu, 25 Jun 2009 08:23:04 Z2009-06-25T08:23:04Zhttp://social.msdn.microsoft.com/Forums/en-US/sharepointdevelopment/thread/74ae249f-c3e4-4513-b811-1ea4402580ba#12095486-34c2-4d9e-a4c8-80009020c37ehttp://social.msdn.microsoft.com/Forums/en-US/sharepointdevelopment/thread/74ae249f-c3e4-4513-b811-1ea4402580ba#12095486-34c2-4d9e-a4c8-80009020c37ePeter Holparhttp://social.msdn.microsoft.com/Profile/en-US/?user=Peter%20HolparError the URL '' is invalid. When using ItemsUpdated in a photo lib<p>Hi Patrick,<br/><br/>Please, let me know the status of your issue!<br/><br/>If it was helpful or answers your question, please mark it as such. If you need more help on the topic, please, let us know how we can help you!</p> <p>Thanks!</p> <p>Peter</p>Fri, 26 Jun 2009 19:48:03 Z2009-06-26T19:48:03Zhttp://social.msdn.microsoft.com/Forums/en-US/sharepointdevelopment/thread/74ae249f-c3e4-4513-b811-1ea4402580ba#3e6975b6-a833-4b53-8a33-a5dbdc6d8077http://social.msdn.microsoft.com/Forums/en-US/sharepointdevelopment/thread/74ae249f-c3e4-4513-b811-1ea4402580ba#3e6975b6-a833-4b53-8a33-a5dbdc6d8077Patrick.Ihttp://social.msdn.microsoft.com/Profile/en-US/?user=Patrick.IError the URL '' is invalid. When using ItemsUpdated in a photo libThanks Peter.<br/>I haven't gone back to it yet when i get back to it and test it i will let you know<br/>CheersSat, 27 Jun 2009 11:17:06 Z2009-06-27T11:17:06Zhttp://social.msdn.microsoft.com/Forums/en-US/sharepointdevelopment/thread/74ae249f-c3e4-4513-b811-1ea4402580ba#a202771c-87db-45a7-8030-65ea9940a297http://social.msdn.microsoft.com/Forums/en-US/sharepointdevelopment/thread/74ae249f-c3e4-4513-b811-1ea4402580ba#a202771c-87db-45a7-8030-65ea9940a297Peter Holparhttp://social.msdn.microsoft.com/Profile/en-US/?user=Peter%20HolparError the URL '' is invalid. When using ItemsUpdated in a photo libHi Patrick,<br/><br/>Thanks in advance!<br/><br/>PeterSat, 27 Jun 2009 11:28:46 Z2009-06-27T11:28:46Zhttp://social.msdn.microsoft.com/Forums/en-US/sharepointdevelopment/thread/74ae249f-c3e4-4513-b811-1ea4402580ba#3e8c24aa-847e-4551-90d9-22d942886573http://social.msdn.microsoft.com/Forums/en-US/sharepointdevelopment/thread/74ae249f-c3e4-4513-b811-1ea4402580ba#3e8c24aa-847e-4551-90d9-22d942886573Patrick.Ihttp://social.msdn.microsoft.com/Profile/en-US/?user=Patrick.IError the URL '' is invalid. When using ItemsUpdated in a photo libHi Peter,<br/> I tried the below but its not doing anything...<br/> <br/>  public override void ItemUpdating(SPItemEventProperties properties)<br/>         {<br/>             SPListItem doc = properties.ListItem;<br/>             string sn = doc[&quot;FileLeafRef&quot;].ToString();<br/>             properties.AfterProperties[&quot;Name&quot;] = String.Format(&quot;{0}_{1}&quot;, sn, sn);<br/>             base.ItemUpdating(properties);<br/>         }<br/>        Mon, 29 Jun 2009 01:22:38 Z2009-06-29T01:22:38Zhttp://social.msdn.microsoft.com/Forums/en-US/sharepointdevelopment/thread/74ae249f-c3e4-4513-b811-1ea4402580ba#87062a0d-f91b-4e59-9356-49111a094dc4http://social.msdn.microsoft.com/Forums/en-US/sharepointdevelopment/thread/74ae249f-c3e4-4513-b811-1ea4402580ba#87062a0d-f91b-4e59-9356-49111a094dc4Peter Holparhttp://social.msdn.microsoft.com/Profile/en-US/?user=Peter%20HolparError the URL '' is invalid. When using ItemsUpdated in a photo libHi Patrick,<br/><br/>Have you checked using the debugger that your code is being called and there is no exception?<br/><br/>I suggest to always use a try / catch block within the receiver, and trace out (System.Diagnostics.Trace, <a href="http://msdn.microsoft.com/en-us/library/system.diagnostics.trace.aspx">http://msdn.microsoft.com/en-us/library/system.diagnostics.trace.aspx</a>) the exceptions if happen. Also, it is good practice to trace out each entry and exit points in you receiver.<br/><br/>PeterMon, 29 Jun 2009 06:44:36 Z2009-06-29T06:44:36Zhttp://social.msdn.microsoft.com/Forums/en-US/sharepointdevelopment/thread/74ae249f-c3e4-4513-b811-1ea4402580ba#1948d7e7-b667-4273-aee4-31fcece27dfchttp://social.msdn.microsoft.com/Forums/en-US/sharepointdevelopment/thread/74ae249f-c3e4-4513-b811-1ea4402580ba#1948d7e7-b667-4273-aee4-31fcece27dfcPatrick.Ihttp://social.msdn.microsoft.com/Profile/en-US/?user=Patrick.IError the URL '' is invalid. When using ItemsUpdated in a photo libHi Peter,<br/>         I still get error <br/> Save Conflict<br/> Your changes conflict with those made concurrently by another user. If you want your changes to be applied, click Back in your Web browser, refresh the page, and resubmit your changes. <br/> <br/> and then<br/> <br/> <br/> The URL 'MyPicLib/Dock.jpg' is invalid.  It may refer to a nonexistent file or folder, or refer to a valid file or folder that is not in the current Web<br/> <br/> When i do the following:<br/> The image does get uploaded and the image name does change but i always have to go back and CHECK IT IN since i get the error on the preview page when i click<br/> CHECK IN.<br/> <br/> Code below:<br/> public override void ItemUpdated(SPItemEventProperties properties)<br/>         {<br/> <br/>             DisableEventFiring();<br/> <br/>             SPWeb web = properties.OpenWeb();<br/>             SPSite site = web.Site;<br/> <br/>             web.AllowUnsafeUpdates = true;<br/>             site.AllowUnsafeUpdates = true;<br/>             <br/>             SPListItem doc = properties.ListItem;<br/>             string sn = properties.AfterProperties[&quot;StoreName&quot;].ToString();<br/>             doc[&quot;Name&quot;] = String.Format(&quot;{0}_{1}&quot;, sn, sn);<br/>             doc.Update();<br/>             base.ItemUpdated(properties);<br/> <br/>             web.AllowUnsafeUpdates = false;<br/>             site.AllowUnsafeUpdates = false;<br/>             EnableEventFiring();<br/> <br/>         }<br/> <br/>Wed, 01 Jul 2009 07:43:05 Z2009-07-01T07:43:05Zhttp://social.msdn.microsoft.com/Forums/en-US/sharepointdevelopment/thread/74ae249f-c3e4-4513-b811-1ea4402580ba#eae286f1-024d-4d28-986b-dff89651eaeahttp://social.msdn.microsoft.com/Forums/en-US/sharepointdevelopment/thread/74ae249f-c3e4-4513-b811-1ea4402580ba#eae286f1-024d-4d28-986b-dff89651eaeaPeter Holparhttp://social.msdn.microsoft.com/Profile/en-US/?user=Peter%20HolparError the URL '' is invalid. When using ItemsUpdated in a photo libHi Patrick,<br/><br/>Which line of code throws the exception(s)? How do you get the second one?<br/><br/>I suggest to slightly modify your code like this:<br/><br/>using System.Diagnostics;<br/><br/>public override void ItemUpdated(SPItemEventProperties properties)<br/>{<br/>    try<br/>    {<br/>            Trace.TraceInformation(&quot;Entering ItemUpdated&quot;);<br/>            DisableEventFiring();<br/><br/>            SPWeb web = properties.OpenWeb();<br/>            SPSite site = web.Site;<br/><br/>            web.AllowUnsafeUpdates = true;<br/>            site.AllowUnsafeUpdates = true;<br/>            <br/>            SPListItem doc = properties.ListItem;<br/>            string sn = properties.AfterProperties[&quot;StoreName&quot;].ToString();<br/>            string newName = String.Format(&quot;{0}_{1}&quot;, sn, sn);<br/>            doc[&quot;Name&quot;] = newName;<br/>            Trace.TraceInformation(&quot;Try to set Name to {0}&quot;, newName);<br/>            doc.Update();<br/>            Trace.TraceInformation(&quot;Item updated&quot;);<br/>            base.ItemUpdated(properties);<br/>            Trace.TraceInformation(&quot;Base ItemUpdated finished&quot;);<br/>    }<br/>    catch(Exception ex)<br/>    {<br/>            Trace.TraceError(&quot;Exception in ItemUpdated. Message: {0}\nStackTrace: {1}&quot;, ex.Message, ex.StackTrace);<br/>    }<br/>    finally<br/>    {<br/>            web.AllowUnsafeUpdates = false;<br/>            site.AllowUnsafeUpdates = false;<br/>            EnableEventFiring();<br/>            Trace.TraceInformation(&quot;Exit from ItemUpdated&quot;);<br/>    }<br/>}<br/><br/>&quot;The image does get uploaded and the image name does change&quot;<br/><br/>Then it seems your event handler do its job.<br/><br/>You wrote you got the error when doing check-in. Isn't there any event handler for ItemCheckinIn (or ItemCheckedIn)?<br/><br/>Peter<br/>Wed, 01 Jul 2009 14:21:42 Z2009-07-01T14:21:42Zhttp://social.msdn.microsoft.com/Forums/en-US/sharepointdevelopment/thread/74ae249f-c3e4-4513-b811-1ea4402580ba#84f09f1b-f4cc-4321-bddf-ebb7e0da4b86http://social.msdn.microsoft.com/Forums/en-US/sharepointdevelopment/thread/74ae249f-c3e4-4513-b811-1ea4402580ba#84f09f1b-f4cc-4321-bddf-ebb7e0da4b86Patrick.Ihttp://social.msdn.microsoft.com/Profile/en-US/?user=Patrick.IError the URL '' is invalid. When using ItemsUpdated in a photo lib<p>Hi Peter,<br/>Thanks alot for the replies<br/>   I decided to sit and get it working today.<br/>  I used  doc.SystemUpdate(false); instead of //doc.Update();<br/>And i stopped getting the error :) and IT WORKED<br/>It seems SystemUpdate doesn't update the modified version<br/>See this <a href="http://msdn.microsoft.com/en-us/library/microsoft.sharepoint.splistitem.systemupdate.aspx">http://msdn.microsoft.com/en-us/library/microsoft.sharepoint.splistitem.systemupdate.aspx</a><br/><br/>Is this a bug?<br/><br/>Also i have lookup field column the users have to select before they checkin an image but i'm trying to use this field to modify the image name.<br/>if i do <br/> string sn = properties.AfterProperties[&quot;LookupFieldName&quot;].ToString();<br/>It doesn't get it i reckon its null.<br/>But it works on other normal fields..<br/>Any ideas?<br/></p>Thu, 02 Jul 2009 07:33:11 Z2009-07-02T07:33:11Zhttp://social.msdn.microsoft.com/Forums/en-US/sharepointdevelopment/thread/74ae249f-c3e4-4513-b811-1ea4402580ba#40f0c1b2-60f9-48e9-b087-306f0b7d7640http://social.msdn.microsoft.com/Forums/en-US/sharepointdevelopment/thread/74ae249f-c3e4-4513-b811-1ea4402580ba#40f0c1b2-60f9-48e9-b087-306f0b7d7640Peter Holparhttp://social.msdn.microsoft.com/Profile/en-US/?user=Peter%20HolparError the URL '' is invalid. When using ItemsUpdated in a photo lib<p>Hi,<br/><br/>&quot;It seems SystemUpdate doesn't update the modified version&quot;<br/><br/>It is by design AFAIK. Or you meant it is a bug that it's not working with simple Update? Well, maybe, but we should know more about the case to decide that.<br/><br/>To get or modify the value of a lookup field you should work with the SPFieldLookupValue (<a href="http://msdn.microsoft.com/en-us/library/microsoft.sharepoint.spfieldlookupvalue.spfieldlookupvalue.aspx">http://msdn.microsoft.com/en-us/library/microsoft.sharepoint.spfieldlookupvalue.spfieldlookupvalue.aspx</a>) for a single choice, or with the SPFieldLookupValueCollection () for a multi choice lookup field.<br/><br/>It is important to use the internal name of the field when you use the AfterProperties, like it is shown here for a single choice lookup field:<br/>ItemAdding() Getting Values from DropDown List on Edit Form<br/><a href="http://social.msdn.microsoft.com/Forums/en-US/sharepointdevelopment/thread/25c91cbf-5c56-42b8-b2b4-4434cef1ff31">http://social.msdn.microsoft.com/Forums/en-US/sharepointdevelopment/thread/25c91cbf-5c56-42b8-b2b4-4434cef1ff31</a><br/><br/>You may receive null because of not using the internal field name (but I would assume an exception instead in this case), or the field may have no value (no selection).<br/><br/>Here is an example about the multi choice lookup:<br/><br/>String fieldValue = Convert.ToString(properties.AfterProperties[internalFieldName]);<br/>SPFieldLookupValueCollection myLookUps = new SPFieldLookupValueCollection(fieldValue);</p> <p>foreach (SPFieldLookupValue myLookUp in myLookUps)<br/>{<br/>  Trace.TraceInformation(&quot;Id: {0}; Value: {1}&quot;, myLookUp.LookupId, myLookUp.LookupValue);<br/>}<br/><br/>Peter</p>Thu, 02 Jul 2009 07:57:27 Z2009-07-02T07:57:27Zhttp://social.msdn.microsoft.com/Forums/en-US/sharepointdevelopment/thread/74ae249f-c3e4-4513-b811-1ea4402580ba#bb0a1998-5f49-4133-8b7e-724bc24574a1http://social.msdn.microsoft.com/Forums/en-US/sharepointdevelopment/thread/74ae249f-c3e4-4513-b811-1ea4402580ba#bb0a1998-5f49-4133-8b7e-724bc24574a1Patrick.Ihttp://social.msdn.microsoft.com/Profile/en-US/?user=Patrick.IError the URL '' is invalid. When using ItemsUpdated in a photo libHi Peter and Thanks<br/> <br/> I used something like this below:-<br/> <br/> SPList list = web.Lists[properties.ListId];<br/> SPField field = list.Fields[LookUpColumnName];<br/> object fieldVal = properties.AfterProperties[field.InternalName];<span style="color:#2b91af"><br/> SPFieldLookupValue</span> fieldValue = <span style="color:blue">new</span> <span style="color:#2b91af">SPFieldLookupValue(<span style="color:#000000">properties.AfterProperties[field.InternalName].toString());<br/> <br/> </span> </span>   string ot= fieldVal.ToString();<br/>  Also used<br/>   string ot= fieldValue .LookupValue.ToString();<br/> <br/>  But no luck.I get something like this :- StoreName_someNumber..<br/>  <br/>   Do i need to use SPFieldLookupValueCollection ?<br/>  Thanks in Advance<br/>Fri, 03 Jul 2009 07:59:08 Z2009-07-03T07:59:08Zhttp://social.msdn.microsoft.com/Forums/en-US/sharepointdevelopment/thread/74ae249f-c3e4-4513-b811-1ea4402580ba#211adbd5-1da3-411f-9db7-52a6f3f9e1e9http://social.msdn.microsoft.com/Forums/en-US/sharepointdevelopment/thread/74ae249f-c3e4-4513-b811-1ea4402580ba#211adbd5-1da3-411f-9db7-52a6f3f9e1e9Peter Holparhttp://social.msdn.microsoft.com/Profile/en-US/?user=Peter%20HolparError the URL '' is invalid. When using ItemsUpdated in a photo libHi Patrick,<br/><br/>&quot;string ot= fieldValue .LookupValue.ToString();&quot;<br/><br/>You should not call the ToString() method, as the LookupValue is a string itself.<br/><br/>&quot;Do i need to use SPFieldLookupValueCollection ?&quot;<br/><br/>I don't think so, but when you attached the debugger, you can see, or you should know from the list fields if your field is multivalued or not.<br/><br/>&quot;I get something like this :- StoreName_someNumber..&quot;<br/><br/>Could you send an example for that (or more)? I really do not know what it might be.<br/><br/>I suggest you to test the code first from a console application (of course using the field value in that instead of the AfterProperties), just to make sure your code that reads the field value is correct. We also had issues with lookup and user fields in event receiver code, as their values from AfterProperties seem to not always parsed correctly by the field.<br/><br/>Peter<br/><br/><br/>Fri, 03 Jul 2009 08:10:26 Z2009-07-03T08:10:26Zhttp://social.msdn.microsoft.com/Forums/en-US/sharepointdevelopment/thread/74ae249f-c3e4-4513-b811-1ea4402580ba#965f05c2-835c-40c4-aeac-bf1fd8158e27http://social.msdn.microsoft.com/Forums/en-US/sharepointdevelopment/thread/74ae249f-c3e4-4513-b811-1ea4402580ba#965f05c2-835c-40c4-aeac-bf1fd8158e27Patrick.Ihttp://social.msdn.microsoft.com/Profile/en-US/?user=Patrick.IError the URL '' is invalid. When using ItemsUpdated in a photo libThanks Peter i will try that<br/> If i remember i think i tried the LookupValue  alone and i didn't get any good result<br/><br/> I get something like this :- StoreName_someNumber..&quot;<br/> If you look at my old post i had:<br/>             SPListItem doc = properties.ListItem;<br/>            string sn = properties.AfterProperties[&quot;StoreName&quot;].ToString();<br/>            string newName = String.Format(&quot;{0}_{1}&quot;, sn, sn);<br/>            doc[&quot;Name&quot;] = newName;<br/><br/>So basically i need to changes the new name to StoreName_LookUpFieldName<br/>So when i had the code to grab the LookUpField<br/>I'm suppose to get :StoreName_LookUpFieldName<br/>But as i said my new image name looks like this now :StoreName_SomeNumber e.g NewYork_3<br/><br/>So its possible values from AfterProperties seem to not always parsed correctly by the field as you stated..<br/>Any ideas?<br/>Hope you got me.<br/><br/><br/>  <br/> Sat, 04 Jul 2009 14:59:08 Z2009-07-04T14:59:08Zhttp://social.msdn.microsoft.com/Forums/en-US/sharepointdevelopment/thread/74ae249f-c3e4-4513-b811-1ea4402580ba#de38abdd-4eed-4622-ac14-dcaf713f4bf0http://social.msdn.microsoft.com/Forums/en-US/sharepointdevelopment/thread/74ae249f-c3e4-4513-b811-1ea4402580ba#de38abdd-4eed-4622-ac14-dcaf713f4bf0Patrick.Ihttp://social.msdn.microsoft.com/Profile/en-US/?user=Patrick.IError the URL '' is invalid. When using ItemsUpdated in a photo libHi Peter...<br/>Thisn has been quite interesting but i go the LookUpFields by doing?<br/><br/> SPFieldLookupValue Loc= new SPFieldLookupValue(doc[&quot;LOutLetLocation&quot;].ToString());<br/> int lookedUpItemID = Loc.LookupId;<br/> string lookedUpItemString = Loc.LookupValue; // Got the text i needed here <br/><br/>I also wanted to include the current date with time so the file name would be changed to sname_loc_currentdatetime<br/><br/> string currentDate = DateTime.Now.ToString(&quot;yyyy-MM-dd&quot;);   but when i do yyyy-MM-dd HH:mm<br/> I can get the date but not the time :(<br/><br/><br/> string newName = String.Format(&quot;{0}_{1}_{2}&quot;, sn, loc, currentDateTime);<br/><br/> All is good but the time doesn't show up when i add the hours and minutes<br/><br/><br/><br/><br/>Mon, 06 Jul 2009 07:25:37 Z2009-07-06T07:25:37Zhttp://social.msdn.microsoft.com/Forums/en-US/sharepointdevelopment/thread/74ae249f-c3e4-4513-b811-1ea4402580ba#b38d79a3-3acb-4e66-ba43-0a22202f2269http://social.msdn.microsoft.com/Forums/en-US/sharepointdevelopment/thread/74ae249f-c3e4-4513-b811-1ea4402580ba#b38d79a3-3acb-4e66-ba43-0a22202f2269Peter Holparhttp://social.msdn.microsoft.com/Profile/en-US/?user=Peter%20HolparError the URL '' is invalid. When using ItemsUpdated in a photo libHi Patrick,<br/><br/>Well, this question seems to be a general .NET question, not SharePoint related, but do you really use <br/> string currentDate = DateTime.Now.ToString(&quot;yyyy-MM-dd&quot;);   but when i do yyyy-MM-dd HH:mm<br/>and not converting a date field valueof a list item to string? In the latter case your date field may be created as a date only field.<br/><br/>&quot;the time doesn't show up when i add the hours and minutes&quot;<br/><br/>Does it show zeros (like 2009-07-06 00:00) or it is missing (like 2009-07-06)?<br/><br/>Back to your previous post:<br/>&quot; I get something like this :- StoreName_someNumber..&quot;<br/>It is because you wrote out the field converted to string &quot;as is&quot; and did not used LookupId and LookUpValue. The simeNumber was the LookupId.<br/><br/>string newName = String.Format(&quot;{0}_{1}&quot;, sn, sn);<br/>Would set newName for the same value (sn) separated with an underscore. I think it is not you would like to do.<br/><br/>PeterMon, 06 Jul 2009 12:42:39 Z2009-07-06T12:42:39Zhttp://social.msdn.microsoft.com/Forums/en-US/sharepointdevelopment/thread/74ae249f-c3e4-4513-b811-1ea4402580ba#48d17502-d3d6-4192-a41c-17f2b3d7e77bhttp://social.msdn.microsoft.com/Forums/en-US/sharepointdevelopment/thread/74ae249f-c3e4-4513-b811-1ea4402580ba#48d17502-d3d6-4192-a41c-17f2b3d7e77bPatrick.Ihttp://social.msdn.microsoft.com/Profile/en-US/?user=Patrick.IError the URL '' is invalid. When using ItemsUpdated in a photo lib<p>DateTime.Now.ToString does print out the hours ,minute and seconds.<br/>The issue was with the concatenation it didn't like the :<br/><br/>I still get the error <strong>The URL 'PhotoLib/interfaa.jpg' is invalid<br/></strong>But after removing the  <br/><br/>web.AllowUnsafeUpdates = true;<br/>site.AllowUnsafeUpdates = true;<br/><br/>and <br/><br/>web.AllowUnsafeUpdates = false;<br/>site.AllowUnsafeUpdates = false;<br/><br/>so only the  doc.SystemUpdate(false); does work :(<br/>Thanks<br/><br/> </p>Tue, 07 Jul 2009 00:48:10 Z2009-07-07T00:48:10Z