Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 4024436
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 20, 20262026-05-20T10:43:17+00:00 2026-05-20T10:43:17+00:00

Have a fun issue with sharepoint calendar view filtering. That code works fine: SPSecurity.RunWithElevatedPrivileges(delegate()

  • 0

Have a fun issue with sharepoint calendar view filtering.
That code works fine:

SPSecurity.RunWithElevatedPrivileges(delegate()
            {
                using (SPSite siteCollection = new SPSite(SPContext.Current.Web.Site.ID))
                {
                    using (SPWeb site = siteCollection.OpenWeb())
                    {
                        site.AllowUnsafeUpdates = true;
                        SPView view = site.Lists["My Calendar"].Views["Calendar"];
                        view.Query = @"<Where><Eq><FieldRef Name='Title'/><Value Type='Text'>ololo</Value></Eq></Where>";
                        view.Update();
                        site.AllowUnsafeUpdates = false;
                    }
                }
            });

But when I change query to

SPSecurity.RunWithElevatedPrivileges(delegate()
            {
                using (SPSite siteCollection = new SPSite(SPContext.Current.Web.Site.ID))
                {
                    using (SPWeb site = siteCollection.OpenWeb())
                    {
                        site.AllowUnsafeUpdates = true;
                        SPView view = site.Lists["My Calendar"].Views["Calendar"];
                        view.Query = @"<Where><Or><Eq><FieldRef Name='Title'/><Value Type='Text'>ololo</Value></Eq><Eq><FieldRef Name='Title'/><Value Type='Text'>trololo</Value></Eq></Or></Where>";
                        view.Update();
                        site.AllowUnsafeUpdates = false;
                    }
                }
            });

I get exception:

Input string was not in a correct format.
Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.

Exception Details: System.FormatException: Input string was not in a correct format.

Source Error:

An unhandled exception was generated during the execution of the current web request. Information regarding the origin and location of the exception can be identified using the exception stack trace below.

Stack Trace:

[FormatException: Input string was not in a correct format.]
System.Number.StringToNumber(String str, NumberStyles options, NumberBuffer& number, NumberFormatInfo info, Boolean parseDecimal) +10161091
System.Number.ParseInt32(String s, NumberStyles style, NumberFormatInfo info) +207
System.Convert.ToInt32(String value, IFormatProvider provider) +55
Microsoft.SharePoint.Utilities.SPUtility.CreateSystemDateTimeFromXmlDataDateTimeFormat(String strDT, Boolean fPreserveMilliseconds) +174
Microsoft.SharePoint.ApplicationPages.Calendar.SafeFieldAccessor.GetDateTimeFieldValue(SPItem item, String fieldName) +227
Microsoft.SharePoint.ApplicationPages.Calendar.CalendarItemRetriever.b_0(SPItem item) +24
System.Linq.WhereListIterator1.MoveNext() +288
System.Linq.<ExceptIterator>d__92
1.MoveNext() +322
System.Linq.Buffer1..ctor(IEnumerable1 source) +548
System.Linq.d
_0.MoveNext() +164
Microsoft.SharePoint.ApplicationPages.Calendar.CalendarItemRetriever.ConvertItemType(IEnumerable1 items) +578
Microsoft.SharePoint.ApplicationPages.Calendar.DefaultCalendarListAccessor.Retrieve(String selectedDate, String scope, Dictionary
2 entityInfo) +18
Microsoft.SharePoint.ApplicationPages.Calendar.CalendarService.CreateStartupResponse(ICalendarAccessor accessor, Dictionary`2 parameters, String viewType, String selectedDate) +249
Microsoft.SharePoint.ApplicationPages.WebControls.AjaxCalendarView.CreateStartupData(String viewType, String selectedDate) +462
Microsoft.SharePoint.ApplicationPages.WebControls.AjaxCalendarView.CreateBodyOnLoadScript(SPWeb web) +306
Microsoft.SharePoint.ApplicationPages.WebControls.AjaxCalendarView.OnPreRender(EventArgs e) +425
System.Web.UI.Control.PreRenderRecursiveInternal() +108
System.Web.UI.Control.PreRenderRecursiveInternal() +224
System.Web.UI.Control.PreRenderRecursiveInternal() +224
System.Web.UI.Control.PreRenderRecursiveInternal() +224
System.Web.UI.Control.PreRenderRecursiveInternal() +224
System.Web.UI.Control.PreRenderRecursiveInternal() +224
System.Web.UI.Control.PreRenderRecursiveInternal() +224
System.Web.UI.Control.PreRenderRecursiveInternal() +224
System.Web.UI.Control.PreRenderRecursiveInternal() +224
System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) +3394

Does anybody know how fix that problem?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-20T10:43:18+00:00Added an answer on May 20, 2026 at 10:43 am

    The problem is solved. “DateRangesOverlap” should be added to the calendar query.

    view.Query = @"<Where><And><DateRangesOverlap>
        <FieldRef Name='EventDate' />
        <FieldRef Name='EndDate' />
        <FieldRef Name='RecurrenceID' />
        <Value Type='DateTime'><Month /></Value>
    </DateRangesOverlap>
    <Or><Eq><FieldRef Name='Title' />
    <Value Type='Text'>orlolo</Value></Eq>
    <Eq><FieldRef Name='Title' />
    <Value Type='Text'>trololo</Value></Eq>
    </Or></And></Where>";
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have been sold on the fun of using linq in areas other than
I have some Scala code that makes fairly heavy use of generics, and I
I have a program that returns int*int (Example for illustration purposes): fun program(a,b) =
Microsoft Visual Studio (2005 and 2008) seems to have fun shuffling the Project IDs
I have downloaded Privoxy few weeks ago and for the fun I was curious
I have started coding an FTP client application (for fun). I’m trying to represent
I have following classes. class A { public: void fun(); } class B: public
I'm writing a basic planet viewer OpenGL Perl application, just for fun. I have
When using the std::for_each, class A; vector<A*> VectorOfAPointers; std::for_each(VectorOfAPointers.begin(), VectorOfAPointers.end(), std::mem_fun(&A::foo)); If we have
Have just started using Google Chrome , and noticed in parts of our site,

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.