Get Calendar List Item GUID

I downloaded code for a reservation event receiver from here: 
http://blog.sharepointsydney.com.au/post/Setting-up-multiple-calendars-for-meeting-room-bookings-prevent-double-booking.aspx
However, on the ItemUpdating it throws an "Object Reference Not Set to an Instance of an Object" error.  By commenting out parts of the code and re-deploying I have narrowed the issue down to the line that gets the item's GUID:
string guid_internal = collItems.List.Fields["GUID"].InternalName;
When I modify it to something like "UniqueId" I get the "Value does not fall within expected range" error.  Is there a better way to obtain the GUID of the calendar list item - or am I missing something?  Full code below:
using System;
using Microsoft.SharePoint;
namespace Webcoda.WSS.Calendar.Events
class PreventDoubleBooking: SPItemEventReceiver
/// <summary>
/// This event is triggered when the user adds a new item
/// </summary>
/// <param name="properties"></param>
public override void ItemAdding(SPItemEventProperties properties)
//Our query string variable
string strQuery = null;
try
//Get the Sharepoint site instance
using (SPWeb oWebsite = new SPSite(properties.SiteId).OpenWeb(properties.RelativeWebUrl))
//Get the collection of properties for the Booking item
SPListItemCollection collItems = oWebsite.Lists[properties.ListTitle].Items;
//Get the Calendar List that we will be querying against
SPList calendar = oWebsite.Lists[properties.ListId];
//Get the internal name of the fields we are querying.
//These are required for the CAML query
string start_internal = collItems.List.Fields["Start Time"].InternalName;
string end_internal = collItems.List.Fields["End Time"].InternalName;
string MeetingRoom_Internal = collItems.List.Fields["Meeting Room"].InternalName;
//Get the query string parameters
string start_str = properties.AfterProperties[start_internal].ToString();
string end_str = properties.AfterProperties[end_internal].ToString();
string MeetingRoom_str = properties.AfterProperties[MeetingRoom_Internal].ToString();
//Construct a CAML query
SPQuery query = new SPQuery();
//Create the CAML query string that checks to see if the booking we are attemping
//to add will overlap any existing bookings
strQuery = string.Format(@"
<Where>
<And>
<Or>
<Or>
<And>
<Leq>
<FieldRef Name='EventDate' />
<Value Type='DateTime' IncludeTimeValue='TRUE'>{0}</Value>
</Leq>
<Gt>
<FieldRef Name='EndDate' />
<Value Type='DateTime' IncludeTimeValue='TRUE'>{0}</Value>
</Gt>
</And>
<And>
<Lt>
<FieldRef Name='EventDate' />
<Value Type='DateTime' IncludeTimeValue='TRUE'>{1}</Value>
</Lt>
<Geq>
<FieldRef Name='EndDate' />
<Value Type='DateTime' IncludeTimeValue='TRUE'>{1}</Value>
</Geq>
</And>
</Or>
<Or>
<And>
<Leq>
<FieldRef Name='EventDate' />
<Value Type='DateTime' IncludeTimeValue='TRUE'>{0}</Value>
</Leq>
<Geq>
<FieldRef Name='EndDate' />
<Value Type='DateTime' IncludeTimeValue='TRUE'>{1}</Value>
</Geq>
</And>
<And>
<Geq>
<FieldRef Name='EventDate' />
<Value Type='DateTime' IncludeTimeValue='TRUE'>{0}</Value>
</Geq>
<Leq>
<FieldRef Name='EndDate' />
<Value Type='DateTime' IncludeTimeValue='TRUE'>{1}</Value>
</Leq>
</And>
</Or>
</Or>
<Eq>
<FieldRef Name='Meeting_x0020_Room' />
<Value Type='Choice'>{2}</Value>
</Eq>
</And>
</Where>
<OrderBy>
<FieldRef Name='EventDate' />
</OrderBy>
", start_str, end_str, MeetingRoom_str);
//Set the query string for the SPQuery object
query.Query = strQuery;
//Execute the query against the Calendar List
SPListItemCollection existing_events = calendar.GetItems(query);
//Check to see if the query returned any overlapping bookings
if (existing_events.Count > 0)
//Cancels the ItemAdd action and redirects to error page
properties.Cancel = true;
//Edit the error message that will display on the error page
properties.ErrorMessage += "This booking cannot be made because of one or more bookings in conflict. <BR><BR>";
//Here you can loop through the results of the query
//foreach (SPListItem oListItem in existing_events)
properties.ErrorMessage += "Please go back and schedule a new time.";
catch (Exception ex)
//Cancels the ItemAdd action and redirects to error page
properties.Cancel = true;
//Edit the error message that will display on the error page
properties.ErrorMessage = "Error looking for booking conflicts: " + ex.Message;
/// <summary>
/// This event is triggered when the user edits an calendar item
/// </summary>
/// <param name="properties"></param>
public override void ItemUpdating(SPItemEventProperties properties) {
string strQuery = null;
try {
//Get the Sharepoint site instance
using (SPWeb oWebsite = new SPSite(properties.SiteId).OpenWeb(properties.RelativeWebUrl)) {
//Get the collection of properties for the Booking item
SPListItemCollection collItems = oWebsite.Lists[properties.ListTitle].Items;
//Get the Calendar List that we will be querying against
SPList calendar = oWebsite.Lists[properties.ListId];
//Get the internal name of the fields we are querying.
//These are required for the CAML query
string start_internal = collItems.List.Fields["Start Time"].InternalName;
string end_internal = collItems.List.Fields["End Time"].InternalName;
string MeetingRoom_Internal = collItems.List.Fields["Meeting Room"].InternalName;
string guid_internal = collItems.List.Fields["GUID"].InternalName;
//Get the query string parameters
string start_str = properties.AfterProperties[start_internal].ToString();
string end_str = properties.AfterProperties[end_internal].ToString();
string MeetingRoom_str = properties.AfterProperties[MeetingRoom_Internal].ToString();
string guid_str = properties.AfterProperties[guid_internal].ToString();
//Construct a CAML query
SPQuery query = new SPQuery();
//Create the CAML query string that checks to see if the booking we are attemping
//to change will overlap any existing bookings, OTHER THAN ITSELF
strQuery = string.Format(@"
<Where>
<And>
<And>
<Or>
<Or>
<And>
<Leq>
<FieldRef Name='EventDate' />
<Value Type='DateTime' IncludeTimeValue='TRUE'>{0}</Value>
</Leq>
<Gt>
<FieldRef Name='EndDate' />
<Value Type='DateTime' IncludeTimeValue='TRUE'>{0}</Value>
</Gt>
</And>
<And>
<Lt>
<FieldRef Name='EventDate' />
<Value Type='DateTime' IncludeTimeValue='TRUE'>{1}</Value>
</Lt>
<Geq>
<FieldRef Name='EndDate' />
<Value Type='DateTime' IncludeTimeValue='TRUE'>{1}</Value>
</Geq>
</And>
</Or>
<Or>
<And>
<Leq>
<FieldRef Name='EventDate' />
<Value Type='DateTime' IncludeTimeValue='TRUE'>{0}</Value>
</Leq>
<Geq>
<FieldRef Name='EndDate' />
<Value Type='DateTime' IncludeTimeValue='TRUE'>{1}</Value>
</Geq>
</And>
<And>
<Geq>
<FieldRef Name='EventDate' />
<Value Type='DateTime' IncludeTimeValue='TRUE'>{0}</Value>
</Geq>
<Leq>
<FieldRef Name='EndDate' />
<Value Type='DateTime' IncludeTimeValue='TRUE'>{1}</Value>
</Leq>
</And>
</Or>
</Or>
<Eq>
<FieldRef Name='Meeting_x0020_Room' />
<Value Type='Choice'>{2}</Value>
</Eq>
</And>
<Neq>
<FieldRef Name='GUID' />
<Value Type='GUID'>{3}</Value>
</Neq>
</And>
</Where>
<OrderBy>
<FieldRef Name='EventDate' />
</OrderBy>
", start_str, end_str, MeetingRoom_str, guid_str);
//Set the query string for the SPQuery object
query.Query = strQuery;
//Execute the query against the Calendar List
SPListItemCollection existing_events = calendar.GetItems(query);
//Check to see if the query returned any overlapping bookings
if (existing_events.Count > 0)
//Cancels the ItemAdd action and redirects to error page
properties.Cancel = true;
//Edit the error message that will display on the error page
properties.ErrorMessage += "This booking cannot be made because of one or more bookings in conflict. <BR><BR>";
//Here you can loop through the results of the query
//foreach (SPListItem oListItem in existing_events)
properties.ErrorMessage += "Please go back and schedule a new time.";
catch (Exception ex)
//Cancels the ItemAdd action and redirects to error page
properties.Cancel = true;
//Edit the error message that will display on the error page
properties.ErrorMessage = "Error looking for booking conflicts: " + ex.Message;

Hi there,
Please verify the internal name of column which you have hardcoded in the code i.e 
string start_internal = collItems.List.Fields["Start Time"].InternalName;
string end_internal = collItems.List.Fields["End Time"].InternalName;
I have used the Room reservation template from MSDN which has provided by MS under the code name of "Fantastic 40" along with below James Finn article.
http://www.codeproject.com/Articles/30983/SharePoint-Reservations
It worked for me for reservation. 

Similar Messages

  • Unable to Read Calendar List Items through CAML

    Hi All,
    * I have created two columns in calendar one Year and other Month.When new event is added in calendar through (Item Added) event receiver I am setting the values to this columns as Name of Month to(February) and Year as(2014)  .So that I can fetch the
    data easily based on month and year
    * Through this Columns Secondly when I try to fetch the data to count number of items of particular month and year using caml query I am getting error as below .
    "Error:One or more field types are not installed properly. Go to the list settings page to delete these fields."
    *My below caml code is working fine if i applied to custom list,But not to calendar.Can any one help me for what reason I am unable to fetch data
    Code
     string year="2014";
     string month="February";
     SPSite mysite = SPContext.Current.Site;
     SPWeb myweb = mysite.OpenWeb();
    SPList mylist = myweb.Lists["Calendar"];
     SPQuery myquery = new SPQuery();
      myquery.Query = @"<Where>
                                          <And>
                                           <Eq>
                                             <FieldRef Name='Year'/>
                                             <Value Type='Text'>" + year + @"</Value>
                                          </Eq>
                                          <Eq>
                                             <FieldRef Name='Month' />
                                             <Value Type='Text'>" + month + @"</Value>
                                          </Eq>
                                         </And>
                                      </Where>";
     SPListItemCollection totaltiems = mylist.GetItems(myquery);
      Label1.Text= "Total Number of Items is "+" "+totaltiems.Count.ToString();
    Thanks, Quality Communication Provides Quality Work. http://siddiq-sharepoint2010.blogspot.in/ Siddiqali Mohammad .

    Hi,
    According to your post, my understanding is that you got an error when read calendar list items using CAML.
    I created two single line of text columns in the Calendar( Year and Month), then add items in the Calendar to check with your code. The CAML query worked well as below.
    string year = "2014";
    string month = "February";
    using (SPSite oSiteCollection = new SPSite("Your site URL"))
    using (SPWeb myweb = oSiteCollection.OpenWeb())
    SPList mylist = myweb.Lists["Calendar"];
    SPQuery myquery = new SPQuery();
    myquery.Query = @"<Where> <And> <Eq> <FieldRef Name='Year'/> <Value Type='text'>" + year
    + "</Value></Eq><Eq>+ "
    + " <FieldRef Name='Month' />+ "
    + " <Value Type='text'>" + month + "</Value>+ "
    + " </Eq> </And></Where>";
    SPListItemCollection totaltiems = mylist.GetItems(myquery);
    Console.WriteLine( "Total Number of Items is " + " " + totaltiems.Count.ToString());
    Console.ReadLine();
    Which type of the two columns in your Calendar? Were they text type?
    Are you sure the field name(<FieldRef Name='Year'/>,
    <FieldRef Name='Month' />) is same as internal name?
    We should only use internal name while refrencing columns in CAML query. If you have space In you column , replace it with "_x0020_", such as
    News_x0020_Category. 
    Thanks & Regards,
    Jason 
    Jason Guo
    TechNet Community Support

  • Webpart - Get selected list items

    All,
    I have a SharePoint list and a webpart located above it. In the webpart, I have a button. Is there a way to know the selected list items when user clicks on the button?
    For example, I have a Company list which contains Company A, B, C, and D. User has selected Company A and D. When user clicks on the button of the webpart, could the webpart know that Company A and D has been selected?
    Thanks,

    check this
    http://social.msdn.microsoft.com/Forums/en-US/699166b1-9d98-44bd-b07c-2c508215a11a/how-to-get-the-selectedchecked-list-item-id-in-list-item-view-webpart-using-jquery?forum=sharepointcustomizationprevious
    http://social.msdn.microsoft.com/Forums/en-US/3d15fd44-adb1-4b51-a56e-6811220e5a60/how-to-get-the-selected-item-of-a-sharepoint-list-?forum=sharepointdevelopmentlegacy

  • Get attachment list items

    Hi,
    in transaction ME21N (or ME22N & ME23N), i created some notes with Generic Object Service.
    Now, in ABAP i would like to get back items of this list. Can you send me an ABAP example ?
    Thanks for your help.
    Cheers.

    Try something like following
    PARAMETERS P_EBELN LIKE EKKO-EBELN.
    DATA : GS_OBJECT   TYPE          SIBFLPORB,
           GT_LINKS    TYPE TABLE OF OBL_S_LINK,
           GS_LINKS    TYPE          OBL_S_LINK,
           GS_FOLDERID TYPE          SOODK,
           GS_OBJECTID TYPE          SOODK,
           GS_NOTE_HD  TYPE          SOOD2,
           GT_NOTE_LN  TYPE TABLE OF SOLI WITH HEADER LINE.
    GS_OBJECT-INSTID = P_EBELN.
    GS_OBJECT-TYPEID = 'BUS2012'.
    GS_OBJECT-CATID  = 'BO'.
    TRY.
        CALL METHOD CL_BINARY_RELATION=>READ_LINKS_OF_BINREL
          EXPORTING
            IS_OBJECT    = GS_OBJECT
            IP_RELATION  = 'NOTE'
          IMPORTING
            ET_LINKS     = GT_LINKS
    *      ET_ROLES     =
      CATCH CX_OBL_PARAMETER_ERROR .
      CATCH CX_OBL_INTERNAL_ERROR .
      CATCH CX_OBL_MODEL_ERROR .
    ENDTRY.
    LOOP AT GT_LINKS INTO GS_LINKS.
      GS_FOLDERID = GS_LINKS-INSTID_B+00(17).
      GS_OBJECTID = GS_LINKS-INSTID_B+17(17).
      CALL FUNCTION 'SO_OBJECT_READ'
        EXPORTING
    *   FILTER                           =
          FOLDER_ID                        = GS_FOLDERID
    *   FORWARDER                        =
          OBJECT_ID                        = GS_OBJECTID
    *   OWNER                            =
    *   F_MAILER                         = ' '
    IMPORTING
    *   OBJECT_FL_DISPLAY                =
        OBJECT_HD_DISPLAY                = GS_NOTE_HD
    *   OBJECT_RC_DISPLAY                =
    TABLES
        OBJCONT                          = GT_NOTE_LN[]
    *   OBJHEAD                          =
    *   OBJPARA                          =
    *   OBJPARB                          =
    EXCEPTIONS
       ACTIVE_USER_NOT_EXIST            = 1
       COMMUNICATION_FAILURE            = 2
       COMPONENT_NOT_AVAILABLE          = 3
       FOLDER_NOT_EXIST                 = 4
       FOLDER_NO_AUTHORIZATION          = 5
       OBJECT_NOT_EXIST                 = 6
       OBJECT_NO_AUTHORIZATION          = 7
       OPERATION_NO_AUTHORIZATION       = 8
       OWNER_NOT_EXIST                  = 9
       PARAMETER_ERROR                  = 10
       SUBSTITUTE_NOT_ACTIVE            = 11
       SUBSTITUTE_NOT_DEFINED           = 12
       SYSTEM_FAILURE                   = 13
       X_ERROR                          = 14
       OTHERS                           = 15
      IF SY-SUBRC <> 0.
        MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
                WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
      ENDIF.
      WRITE:/ 'TITLE :' ,GS_NOTE_HD-OBJDES.
      LOOP AT GT_NOTE_LN.
        WRITE:/ GT_NOTE_LN-LINE.
      ENDLOOP.
    ENDLOOP.

  • Is there a way to have the description field in a calendar list item to support enhanced rich text?

    We have a user who has a few hundred calendar items created in outlook. If you open the calendar item, the description includes tables with borders, shading, etc. It seems that the description field in Sharepoint calendars only support basic rich text,
    so if I copy the items from the user's calendar to the sharepoint calendar, the formatting is lost. Is there any way to create a custom calendar with enhanced rich text for the description field?

    This is a workaround that is working for us.  I created a new column "Event Description", selected "Plain Text" and then created a basic workflow that updated Description from Event Description.  #160 is no longer showing.
    Please be aware that the trick to this is that you must write everything in a string.  In other words, don't use the Enter key. 
    In my case it was worth it as we couldn't rebuild and the user needed a valid and quick fix.
    Cynthia Duke
    Cynthia Duke

  • FM to get Item Guids from Header Guid?

    Hi Experts,
    I have the order header guid. Is there any Function Module to get the corresponding item guids for that header if we just pass the header guid as input?
    (Other than CRM_ORDER_READ)
    Any pointers will be appreciated!
    Thanks and Regards,
    Rohit
    Edited by: rohit raturi on Aug 4, 2008 11:22 AM

    Hi Lilach,
    Thanks for the response.But actually table read is always expensive. I want to put some checks before order save.But when I am calling CRM_ORDER_READ inside ORDER_SAVE BADI, I am getting the exception-SY_CX_NO_HANDLER.
    Any idea why this exception is coming?
    Thanks and Regards,
    Rohit

  • Error in getting the List Id in Visual studio Update Lsit item workflow activity

    Hi All,
    I am continuously getting this error 
    RequestorId: 65a82d7b-122b-b5ad-238b-3b7cde25c8aa. Details: System.FormatException: Expected hex 0x in '{0}'. at System.Guid.GuidResult.SetFailure(ParseFailureKind failure, String failureMessageID, Object failureMessageFormatArgument) at System.Guid.TryParseGuidWithHexPrefix(String
    guidString, GuidResult& result) at System.Guid.TryParseGuid(String g, GuidStyles flags, GuidResult& result) at System.Guid.Parse(String input) at System.Activities.CodeActivity`1.InternalExecute(ActivityInstance instance, ActivityExecutor executor,
    BookmarkManager bookmarkManager) at System.Activities.Runtime.ActivityExecutor.ExecuteActivityWorkItem.ExecuteBody(ActivityExecutor executor, BookmarkManager bookmarkManager, Location resultLocation).
    I know that workflow not ale to get my list's guid at run time and  it is a bug which is yet not fixed.
    I have already tried changing
    System.Guid.Parse("{$ListId:Lists/MyList;}") with the list GUID 
    System.Guid.Parse("{75DD48E6-44D3-43B1-BD83-D836CDE04FB9}").
    and this blog
    sp2013workflows.blogspot.ru/.../lookup-activities-in-visual-studio-2012.html
    but still workflows not working.
    any other option can i try?

    Hi Alok,
    Thanks for sharing ! It will help others who stuck with the same issue !
    Best Regards
    Zhengyu Guo
    TechNet Community Support

  • Getting the version history of a list item

    I am creating a content web part and one the list items is used with versioning. I want to show all the versioning on the page. Is there anyway to do this? maybe using CSOM or something. In Javascript

    Hi,
    According to your post, my understanding is that you want to get the list item version using CSOM or JavaScript.
    There is no directly way to get the list item version using CSOM or REST Api, however, there are alternative options as below.
    We can use the SharePoint List web service
    that exposes Lists.GetVersionCollection Method to return version information for the specified field in a SharePoint list.
    There is a code demo to retrieve the List1 item version, it works like a charm, you can refer to it.
    <script type="text/javascript" src="../Shared Documents/jquery-1.11.0.min.js"></script>
    <script type="text/javascript" src="../Shared Documents/jquery.SPServices-2014.01.min.js"></script>
    <script type="text/javascript">
    $(function(){
    $().SPServices({
    operation: "GetVersionCollection",
    async: false,
    strlistID: "Lists_1",
    strlistItemID: 1,
    strFieldName: "Title",
    completefunc: function (xData, Status) {
    console.log(xData);
    $(xData.responseText).find("Version").each(function(i) {
    console.log("Name: " + $(this).attr("Title") + " Modified: " + $(this).attr("Modified"));
    </script>
    What’s more, we can also get request to Versions.aspx page to get the list item version.
    There is an article about this topic, you can have a look at it.
    http://stackoverflow.com/questions/24423657/sharepoint-2013-get-splistitem-versions-via-rest
    Thanks & Regards,
    Jason
    Jason Guo
    TechNet Community Support

  • InfoPath: Cascading Fields, need to get ID of final selected list item

    I have a two drop down lists in an InfoPath form. They are getting their data from a SharePoint List that has two columns: Objectives, Strategies.
    The drop down lists are cascading. So dropdown list 2 (DDL2) values change depending on what dropdown list 1 (DDL1) is set to.
    So my list looks like this:
    objective 1 - strategy 1
    objective 1 - strategy 2
    objective 1 - strategy 3
    objective 2 - strategy 1
    objective 2 - strategy 2
    The cascading part in InfoPath works correctly. My problem is that I need to get the ID of the item (strategy) selected in DDL2.
    DDL1 gets its values from an external data source (sharePoint list):
    Entries: /dfs:myFields/dfs:dataFields/d:SharePointListItem_RW
    Value: d:Objective
    Display name: d:Objective
    DDL2 gets its values from the same external data source (sharePoint list):
    Entries: /dfs:myFields/dfs:dataFields/d:SharePointListItem_RW/d:Strategies[../d:Objective = xdXDocument:get-DOM()/dfs:myFields/dfs:dataFields/my:SharePointListItem_RW/my:obj]
    Strategy is filtered based on Objective = Objective
    Value: Strategies
    Display name: Strategies
    How can I get the ID of the Strategy selected in DDL2 so that I can write it out to another column that SharePoint can use in a workflow. The only value returned in for DDL2 is Strategy, no ID option.

    Hi Sonners,
    If you want to get the ID of the selected "Strategy" item in DDL2, I think you may need to use the same approach to retrieve the same external data source(SharePoint list have the Objectives and Strategies columns) on another field, then
    filter the list item ID based on the selected Strategy value in DDL2 which equals to the strategy value in that external SharePoint list.
    Or you don't need to get the list item ID of the "Strategy" selected in DDL2 in InfoPath form, you can directly get the list item ID which is filtered by the condition SharePoint list item "Strategy" column value equals
    to the value selected in DDL2 in Desinger workflow, then use the ID value as you want in workflow.
    I have tried a similar method for another requirement like this
    post, you can take a look.
    Thanks
    Daniel Yang
    TechNet Community Support
    Please remember to mark the replies as answers if they help, and unmark the answers if they provide no help. If you have feedback for TechNet Support, contact
    [email protected]

  • Incorrect URL on Calendar List Event in Overlay View

    Hello,
    We're using Standalone SharePoint 2010 installation.
    The agency I work for has a Clerical Staff calendar list. This is the principal calendar staff use so it has several other calendars overlaid in the list view.
    One such calendar was Volunteer Schedule. Once this was no longer used I renamed the volulnteer calendar to payroll calendar and changed the URL in sharepoint designer 2010. This was successful, I can hit the payroll calendar and the URL is correct.
    However, I'm having issues with the payroll calendar items. When you click on any Payroll Calendar Event in the Clerical Calendar overlay view, the URL for the payroll calendar item resolves to a completely different calendar list and throws
    an "Item Does Not Exist" error.
    I can still add, edit, and delete those items on the payroll calendar specifically, and new adds do show up in the overlay... it's only when you click the Title of that item in the Clerical calendar overlay does the error happen, it's almost as if the Calendar
    list items have lost their connection to their parent calendar list.
    Further investigation has brought no answers, I'd rather not delete and recreate the payroll calendar as it's densely populated.
    Any thoughts or links will be much appreciated.
    Thanks,
    Brian H.

    Hi,
    According to your post, my understanding is that you wanted to solve the issue about the Payroll Calendar Events when you clicked on any Payroll Calendar Event in the Clerical Calendar overlay view in SharePoint 2010.
    I try to reproduce the issue, however, the result is the same as yours.
    If you need to rename the Volulnteer Calendar to Payroll Calendar and change the URL in SharePoint designer 2010, I suggest that you can delete the previous Volulnteer Calendars Overlay and create a new one Payroll Calendars Overlay in the Clerical Calendar
    list.
    I recommend that you can follow the steps as below to implement it.
    1. Open the Clerical Calendar list, go to the “Calendar Tools”, and click the “Calendars Overlay” under “Calendar”.
    2. Click the previous Volulnteer Calendars Overlay, and click the “Delete” button to delete it.
    3. Click “New Calendar”, type the Calendar Name, select the Color and click the “Resolve” button to get the latest information of the Calendar list in the Web URL.
    4. Select the new Payroll Calendar list and click “OK” button.
    Now, you can go back to the Clerical Calendar list and test the new Payroll Calendars Overlay in your environment.
    In addition, you can rename the Volulnteer Calendar through the UI, then the URL will be changed automatically. And then you can click the Calendars Overlay directly.
    To rename the Volulnteer Calendar through the UI, you can follow the steps as below:
    1. Go to “List Settings” of the Volunteer Calendar, and click the “Title, description and navigation” under “General Settings”.
    2. Change the name to “Payroll” and click “Save” button.
    Then, you can see the new Payroll Calendar list on the Quick Launch.
    For more information, you can refer to:
    How
    to Change the Url For a SharePoint 2010 List or Library
    Changing
    the URL of an existing document library or list
    Best Regards,
    Linda Li
    Linda Li
    TechNet Community Support

  • Setting Item level access rights on sharepoint list item in ItemAdding event handler

    Hi ,
    I am using sharepoint 2013. I am trying to set item level access rights when a list item is added using the following code snippet,
    public override void ItemAdding(SPItemEventProperties properties)
    base.ItemAdding(properties);
    ConfigureItemSecurity(properties);
    private void ConfigureItemSecurity(SPItemEventProperties properties)
    var item=properties.ListItem;
    SPSecurity.RunWithElevatedPrivileges(delegate()
    using (SPSite site = new SPSite(properties.SiteId))
    using (SPWeb oWeb = site.OpenWeb())
    item.ParentList.BreakRoleInheritance(true);
    oWeb.AllowUnsafeUpdates = true;
    var guestRole = oWeb.RoleDefinitions.GetByType(SPRoleType.Reader);
    var editRole = oWeb.RoleDefinitions.GetByType(SPRoleType.Editor);
    SPGroup HRGroup = oWeb.SiteGroups.Cast<SPGroup>().AsQueryable().FirstOrDefault(g => g.LoginName=="HR Team");
    SPRoleAssignment groupRoleAssignment = new SPRoleAssignment(HRGroup);
    groupRoleAssignment.RoleDefinitionBindings.Add(guestRole);
    SPUserCollection users = oWeb.Users;
    SPFieldUserValueCollection hm = (SPFieldUserValueCollection)item["HiringManager"];
    SPFieldUserValueCollection pm = (SPFieldUserValueCollection)item["ProjectManager"];
    SPFieldUserValueCollection pmChiefs = (SPFieldUserValueCollection)item["ProjectManagerChief"];
    item.BreakRoleInheritance(true);
    item.RoleAssignments.Add(groupRoleAssignment);
    foreach (SPFieldUserValue staffMember in hm)
    SetRightsOnItem(item, staffMember, editRole);
    foreach (SPFieldUserValue staffMember in pm)
    SetRightsOnItem(item, staffMember, guestRole);
    foreach (SPFieldUserValue staffMember in pmChiefs)
    SetRightsOnItem(item, staffMember, guestRole);
    item.Update();
    private void SetRightsOnItem(SPListItem item, SPFieldUserValue staffMember, SPRoleDefinition role)
    SPUser employeeUser = staffMember.User;
    var userRoleAssignment = new SPRoleAssignment(employeeUser);
    userRoleAssignment.RoleDefinitionBindings.Add(role);
    item.RoleAssignments.Add(userRoleAssignment);
    Nothing is happening though... Is the event handler the right place to do this?
    thank you

    Hi ,
    You can refer to the code working in my environment:
    using System;
    using System.Security.Permissions;
    using Microsoft.SharePoint;
    using Microsoft.SharePoint.Utilities;
    using Microsoft.SharePoint.Workflow;
    namespace ItemLevelSecurity.ItemSecurity
    /// <summary>
    /// List Item Events
    /// </summary>
    public class ItemSecurity : SPItemEventReceiver
    /// <summary>
    /// An item was added.
    /// </summary>
    public override void ItemAdded(SPItemEventProperties properties)
    SPSecurity.RunWithElevatedPrivileges(delegate()
    try
    using (SPSite oSPSite = new SPSite(properties.SiteId))
    using (SPWeb oSPWeb = oSPSite.OpenWeb(properties.RelativeWebUrl))
    //get the list item that was created
    SPListItem item = oSPWeb.Lists[properties.ListId].GetItemById(properties.ListItem.ID);
    //get the author user who created the item
    SPFieldUserValue valAuthor = new SPFieldUserValue(properties.Web, item["Created By"].ToString());
    SPUser oAuthor = valAuthor.User;
    //assign read permission to item author
    AssignPermissionsToItem(item,oAuthor,SPRoleType.Reader);
    //update the item
    item.Update();
    base.ItemAdded(properties);
    catch (Exception ex)
    properties.ErrorMessage = ex.Message; properties.Status = SPEventReceiverStatus.CancelWithError;
    properties.Cancel = true;
    public static void AssignPermissionsToItem(SPListItem item, SPPrincipal obj, SPRoleType roleType)
    if (!item.HasUniqueRoleAssignments)
    item.BreakRoleInheritance(false, true);
    SPRoleAssignment roleAssignment = new SPRoleAssignment(obj);
    SPRoleDefinition roleDefinition = item.Web.RoleDefinitions.GetByType(roleType);
    roleAssignment.RoleDefinitionBindings.Add(roleDefinition);
    item.RoleAssignments.Add(roleAssignment);
    Thanks,
    Eric
    Forum Support
    Please remember to mark the replies as answers if they help and unmark them if they provide no help. If you have feedback for TechNet Subscriber Support, contact
    [email protected].
    Eric Tao
    TechNet Community Support

  • Caml query for filtering list item not working as expected in Sharepoint hosted app

    I am trying to filter list item based on particular value.
    var header = "xyz";
    camlQueryHeader.set_viewXml = "<view><Query><Where><Eq><FieldRef Name='Position'/>" + "<Value Type='Text'>" + header + "</Value></Eq></Where></Query></view>";
    Instead of getting filtered list items, I get all the list items. What am I missing?
    Note: I am creating Sharepoint hosted app using CSOM.
    regards, Ritesh Anand

    Hi,
    According to the code provided, I suggest you modify the code like this:
    camlQueryHeader.set_viewXml('<view><Query><Where><Eq><FieldRef Name=\'Position\'/>' + '<Value Type=\'Text\'>' + header + '</Value></Eq></Where></Query></view>');
    Here is a documentation of how to use the viewXml property of SP.CamlQuery object:
    SP.CamlQuery.viewXml Property
    Thanks
    Patrick Liang
    TechNet Community Support

  • Passing Multiple Selected List Items to a "New Item" Form in Another List with Multiselect Lookup Field

    Hi!
    Version Info:  SharePoint 2013 Server Standard (*BTW...I do not have access to Visual Studio*)
    I have two lists, let's call them
    -Assets
    -Asset Checkouts
    "Assets" is the parent list, and "Asset Checkouts" has a lookup column (multiselect) which is tied to the serial # column in the "Assets" list.
    Basically, what I need to accomplish is this:  I would like to be able to select multiple list items in the "Assets" list, and create a new item in "Asset Checkouts", and pre-fill the multiselect lookup column in the NewItem form
    for "Asset Checkouts" with the values from the selected items in "Assets".
    Any ideas or suggestions on how to do this would be most appreciated!
    Thanks!

    Hi,     
    According your description, you might want to add new item in "Asset Checkouts" list when selecting items in "Assets" list.
    If so, we can achieve it with SharePoint Client Object Model.
    We can add a button in the "Assets" list form page, when selecting items, we can take down the values of columns of the selected items, then click this button which will create
    new item in "Asset Checkouts" list with the values needed.
    Here are some links will provide more information about how to achieve it:
    Use
    SP.ListOperation.Selection.getSelectedItems() Method to get the list items being selected
    http://msdn.microsoft.com/en-us/library/ff409526(v=office.14).aspx
    How to: Create, Update, and Delete List Items Using JavaScript
    http://msdn.microsoft.com/en-us/library/office/hh185011(v=office.14).aspx
    Add ListItem with Lookup Field using Client Object Model (ECMA)
    http://notuserfriendly.wordpress.com/2013/03/14/add-listitem-with-lookup-field-using-client-object-model-ecma/
    Or if you just want to refer to the other columns in "Assets" list when add new item in "Asset Checkouts" list, we can insert the "Assets" list web part into the NewForm page
    of the "Asset Checkouts" list, then when we add new item in the "Asset Checkouts" list, we will be able to look through the "Assets" list before we select values for the Lookup column.
    To add web part into the NewForm.aspx, we need to find the button "Default New Form" from ribbon under "List" tab, then we can add web part in the NewForm.aspx.
    In the ribbon, click the button “Default New Form”:
    Then we can add web part into NewForm.aspx:
    Best regards
    Patrick Liang
    TechNet Community Support

  • CSOM - Fetching list item version history programmatically

    HI,
    Is it possible to get the List item version history programmatically using Client Object model?
    I have checked these links:
    http://www.learningsharepoint.com/2010/07/16/programmatically-get-document-version-history-using-client-object-model-sharepoint-2010/
    but was not able to achieve. I am not looking for Document library, but for a custom list.
    Thanks

    Hi,
    In SharePoint Object Model, there is a
    SPListItem.Versions property
    can help to “Gets the collection of item version objects that represent the versions of the item”.
    However, in SharePoint Client Object Model, this property is not available at this moment.
    A workaround is that we can create a custom WCF web service for consuming from client side, then in this web service, we can use Object Model to access the versions of a list
    item.
    About how to
    create and a custom WCF web service:
    http://nikpatel.net/2012/02/29/step-by-step-building-custom-wcf-services-hosted-in-sharepoint-part-i/
    This workaround would not be applied to SharePoint Online cause Object Model is needed.
    If there may be some better ideas or solutions about this topic, your sharing would be welcome.
    Thanks
    Patrick Liang
    Forum Support
    Please remember to mark the replies as answers if they
    help and unmark them if they provide no help. If you have feedback for TechNet
    Subscriber Support, contact [email protected]
    Patrick Liang
    TechNet Community Support

  • CheckBox list item

    hi friends
    i am new with itemrenders how can i get the list item
    checkbox(here checkbox is the itemrender) values
    thanks in advance....

    Adobe Newsbot hopes that the following resources helps you.
    NewsBot is experimental and any feedback (reply to this post) on
    its utility will be appreciated:
    mx.controls.List (Flex 3):
    The <mx:List> tag inherits all the tag attributes of
    its superclass, ... [write-only] Used by Flex to suggest bitmap
    caching for the object.
    Link:
    http://livedocs.adobe.com/flex/3/langref/mx/controls/List.html
    Displaying icons in a Flex List control at Flex Examples:
    http://blog.flexexamples.com/2007/08/17/displaying-icons-in-a-flex-list-control/
    --> <mx:Application xmlns:mx='
    http://www.adobe.com/2006/mxml'
    Link:
    http://blog.flexexamples.com/2007/08/17/displaying-icons-in-a-flex-list-control/
    mx.controls.List (Flex 2 Language Reference):
    If the data is incorrect, you can call the preventDefault()
    method to stop Flex from passing the new data back to the list
    control and from closing the
    Link:
    http://livedocs.adobe.com/flex/2/langref/mx/controls/List.html
    Smooth Scroll for Horizontal List - Flex India Community |
    Google:
    I have created image gallery with Horizontal List[Flex 2.0].
    Just as below ref site. My Problem is i need a smooth scroll for
    Horizontal List. where images
    Link:
    http://groups.google.com/group/flex_india/browse_thread/thread/a12441143b98d32c?hide_quote s=no
    Populate the list -- Flex 2.01:
    You populate a list-based form control with the
    <mx:dataProvider> child tag. The <mx:dataProvider> tag
    lets you specify list items in several ways.
    Link:
    http://livedocs.adobe.com/flex/201/html/tutorial_controls_019_4.html
    Selecting multiple items in Flex List and DataGrid controls
    at:
    http://blog.flexexamples.com/2007/11/21/allowing-multiple-selected-items-in-flex-<br>
    list-and-datagrid-controls/ --> <mx:Application
    Link:
    http://blog.flexexamples.com/2007/11/21/selecting-multiple-items-in-flex-list-and-datagrid -controls/
    Disclaimer: This response is generated automatically by the
    Adobe NewsBot based on Adobe
    Community
    Engine.

Maybe you are looking for

  • How to write a class from se24

    Dear Abap sirs, I want to write an abap class using the transaction se24. What is the step to write a simple class.. Thanks.

  • Creative Suite 4

    For a while Illustrator wouldn't open without an error message. Then after a while I couldn't click open a pdf file. I had to right click "open with". So, I tried reinstalling the whole package. It errored with message 1603. The installation of Adobe

  • Dashboards: Wait for a dashprompt selection before executing Answers report

    We have some dashboards consisting of a dashboard prompt and two Answers reports. Because the answers reports take a long time to execute without narrowing the selection, we would like BI to only start executing the Answers reports after a selection

  • Object directory entries

    When I am trying to change the package I am getting the following error message. Object directory entry R3TR DTEL ZZADJ_PER locked for request/task DEVK900251 How to change the object directory entries which are part of a request/task? Please help. T

  • Movieclip color transform

    Hello, I am building a Smile Face application. Where you choose a menu item and an object or "movieclip" is placed on the stage. You can drag and drop the object, take it to the trash and change the color on any of the objects on the stage at any tim