Tuesday, October 20, 2009

SpSiteDataQuery with more than 256 conditions.

Hi

I am getting error :-
Incorrect syntax near 'UserData'.
System.Data.SqlClient.SqlException: Too many table names in the query. The maximum allowable is 256.

if I use spsitedataquery with more than 256 conditions.

at System.Data.SqlClient.SqlConnection.OnError(SqlException exception, Boolean breakConnection) at System.Data.SqlClient.SqlInternalConnection.OnError(SqlException exception, Boolean breakConnection) at System.Data.SqlClient.TdsParser.ThrowExceptionAndWarning(TdsParserStateObject stateObj) at System.Data.SqlClient.TdsParser.Run(RunBehavior runBehavior, SqlCommand cmdHandler, SqlDataReader dataStream, BulkCopySimpleResultSet bulkCopyHandler, TdsParserStateObject stateObj) at System.Data.SqlClient.SqlDataReader.ConsumeMetaData() at System.Data.SqlClient.SqlDataReader.get_MetaData() at System.Data.SqlClient.SqlCommand.FinishExecuteReader(SqlDataReader ds, RunBehavior runBehavior, String resetOptionsString) at System.Data.SqlClient.SqlCommand.RunExecuteReaderTds(CommandBehavior cmdBehavior, RunBehavior runBehavior, Boolean returnStream, Boolean async) at System.Data.SqlClient.SqlCommand.RunExecuteReader(CommandBehavior cmdBehavior, RunBehavior runBehavior, Boolean returnStream, String method, DbAsyncResult result) at System.Data.SqlClient.SqlCommand.RunExecuteReader(CommandBehavior cmdBehavior, RunBehavior runBehavior, Boolean returnStream, String method) at System.Data.SqlClient.SqlCommand.ExecuteReader(CommandBehavior behavior, String method) at System.Data.SqlClient.SqlCommand.ExecuteReader(CommandBehavior behavior) at Microsoft.SharePoint.Utilities.SqlSession.ExecuteReader(SqlCommand command, CommandBehavior behavior) at Microsoft.SharePoint.SPSqlClient.ExecuteQuery(Boolean& bSucceed) at Microsoft.SharePoint.Library.SPRequestInternalClass.CrossListQuery(String bstrUrl, String bstrXmlWebs, String bstrXmlLists, String bstrXmlQuery, ISP2DSafeArrayWriter pCallback, Object& pvarColumns) at Microsoft.SharePoint.Library.SPRequest.CrossListQuery(String bstrUrl, String bstrXmlWebs, String bstrXmlLists, String bstrXmlQuery, ISP2DSafeArrayWriter pCallback, Object& pvarColumns) at Microsoft.SharePoint.SPWeb.GetSiteData(SPSiteDataQuery query) at.......


Did anybody faced this issue before ?


Cheers-Hemant
EMAIL REMOVED

 

Reply 1

Can you include the CAML query you are trying to run, any view field set and background on what you are trying to achieve?




My SharePoint Blog - http://www.davehunter.co.uk/blog

Reply 2

is it something to do with length of the caml query possibly?

Reply 3

The Query property of the SPSiteDataQuery is a string.  I don't believe the CAML Query has a max length.




My SharePoint Blog - http://www.davehunter.co.uk/blog

Thursday, October 15, 2009

detect if new spfile is uploaded

Hi

Is there a way to detect if
a new spfile is uploaded in document library/ old spfile is replaced for the same item
or
only the meta data have been edited. (may be in itemupdated eventhandler.)




Thanks & Regards
Hemant Kumar
EMAIL REMOVED

Reply 1

When a file is replaced, the ItemUpdated event is triggered.  The same is true if you just change the metadata for the file.  Not sure if it's relevant to you, but replacing an existing file does not call ItemDeleted and ItemAdded.  In other words, it's not a delete and add operation.




Randy - http://sharepointhawaii.com/randywilliams

Reply 2

Hi,

Yes, as Williams’s information, both file replacing action and metadata updating action trigger ItemUpdated event.

And perhaps you need to distinguish them by BeforeProperties and AfterProperties.

Here is a  Williams article for detailed information when retrieving event’s  before and after value.

Hope this can help.

 

Best Regards,

-Aaron

Reply 3

Hi,

@hemantrhtk :) Please look at this link :http://www.synergyonline.com/blog/blog-moss/Lists/Posts/Post.aspx?ID=25
A great artcile for eventhandler.

Best Regards,

-Aaron

Reply 4

Hello Aron

Could you suggest , possibly what is is the column /property name which changes while new doc is uploaded/previous doc is overridden.

I tried the same thing before starting this thread with all the properties in loop , but could not figure out the possible column/property name.

Cheers-Hemant