Sunday, November 4, 2012

Microsoft.SharePoint.SPException : Cannot complete this action.\n\n Please try again.

Error: "Cannot complete this action.\n\nPlease try again." exception when trying to save data in a List Library. The full exception is:
Microsoft.SharePoint.SPException was caught
Message="Cannot complete this action.\n\nPlease try again."
Source="Microsoft.SharePoint"
ErrorCode=-2147467259
StackTrace:
at Microsoft.SharePoint.Library.SPRequest.GetListItemDataWithCallback(String bstrUrl, String bstrListName, String bstrViewName, String bstrViewXml, SAFEARRAYFLAGS fSafeArrayFlags, ISP2DSafeArrayWriter pSACallback, ISPDataCallback pPagingCallback, ISPDataCallback pSchemaCallback)
at Microsoft.SharePoint.SPListItemCollection.EnsureListItemsData()
at Microsoft.SharePoint.SPListItemCollection.Undirty()
at Microsoft.SharePoint.SPBaseCollection.System.Collections.IEnumerable.GetEnumerator()
at XXXXX.SharePoint.XXXXXX.XX_XXX_FormUC.SaveOrSubmitSOW(String strSaveOrSubmit)

And the line from which it has been thrown is:
foreach (SPListItem listItem in list.Items)

The code is connecting to the List but unable to read the data. Try to use SPSecurity.RunWithElevatedPrivileges to resolve the issue. If this does not work, try the below option...
If you have a Columns with type Hyperlink, sometimes (I guess) you will face this issue. You need to delete those columns and create again. If then also it doesnt work, change them to text mode and handle the hyperlink functionality in the code behind file.

1 comment:

  1. example please, not sure were to put the security code and how, thanks

    ReplyDelete