I am having trouble getting the AddAttachments GP Tool to work with SDE feature classes. The tool works nicely with the same feature class in a file geodatabase.
Its not failing per se just returning messages like:
Cannot add file 'x'
Notes: 1) I am using the same Input dataset and Match table with the OBJECT ID as the key 2) the Path field is a UNC Path. I tried converting the UNC to a mapped drive....no dice. 3) These files exist on disk. 4) I have tried running the tool within an edit session via arcpy and the da module. Doesn't work either. 5) Its not a privilege issue, I can load the attachments manually in ArcMap (1 @ a time). 6) The attachment table is registered as versioned. 7) Local 10.1 Desktop client with a direct connect to a 10.0 geodatabase (SS 2008 R2).
This is the only thread that I have come across that addresses this issue, but I am experiencing the same behavior in ArcGIS 10.1. Just like the original poster, I have tried:
1. GP tool and python via python window in Desktop. 2. Tried running GP tool in an edit session. 3. File(s) exist on disk on the machine that I am running this tool from. 4. Tried mapped drive and local paths. 5. I can add an attachment manually, so that is working and I have the necessary rights to do so. 6. Tried running GP tool from Catalog and Desktop 7. Etc.
The error is the same as well: "Cannot add file 'X' to feature with OID = 'X'"
The feature class participates in a replica, so making a copy is not an option.
The environment is ArcGIS for Desktop Standard 10.1, SP1. Database in SDE; geodatabase version matches the ArcGIS release.
I opened a case with Esri support and found that this behavior is a known bug - NIM073706 - that pertains to running the Add Attachments tool against data that is registered as versioned. The work around that I used was to compress my database, unregister the feature dataset and attachment table as versioned, and then run the tool. After the tool ran successfully I registered my data as versioned again.