locked
Is there a way to auto create an item in an Announcement List when someone adds a Link to a Link List? RRS feed

  • Question

  • I am VERY new to the SharePoint realm and am in need of assistance.  We are using SharePoint 2010. Would like to create an auto announcement when a link to a new department site is added to our department's links list. So far online has not been any help.

    Please know I appreciate any help and assistance!  :o)

    Thanks

     

     

    Monday, March 7, 2011 2:03 PM

Answers

  • Sure, it's easy to do with an SPD2010 workflow.  Create a list workflow bound to the Links list, add a Create List Item activity in the workflow, and fire the workflow only on creation of a new link.  No code required.
    SharePoint Architect || Microsoft MVP || My Blog
    Planet Technologies || SharePoint Task Force
    • Marked as answer by D_Olin Monday, March 7, 2011 7:33 PM
    Monday, March 7, 2011 3:22 PM

All replies

  • Hi,

    You may implement that by creation Event receiver and handle "An item was added" event for your list.

    Open Visual Studio 2010->Create new Project->SharePoint 2010->Event receiver->Deploy as a farm solution->In the customization wizard you should select "List Item Events", "Links", "An Item was added"->Implement ItemAdded method, it can look like this:

     

    public override void ItemAdded(SPItemEventProperties properties)
    {
      base.ItemAdded(properties);
    
      if (properties.ListTitle.Equals("DepartmentLinkList"))
      {
        using (SPWeb oWebsiteRoot = properties.OpenWeb())
        {
          SPList oList = oWebsiteRoot.Lists["Announcements"];
    
          SPListItem listItem = oList.Items.Add();
    
          listItem["Title"] = "New link " + properties.ListItem.DisplayName + " was added by " + properties.UserDisplayName;
    
          listItem.Update();
        }
      }
    }
    

     

    Dmitry

     


    Lightning Tools Check out our SharePoint tools and web parts

     


    Monday, March 7, 2011 3:01 PM
  • Sure, it's easy to do with an SPD2010 workflow.  Create a list workflow bound to the Links list, add a Create List Item activity in the workflow, and fire the workflow only on creation of a new link.  No code required.
    SharePoint Architect || Microsoft MVP || My Blog
    Planet Technologies || SharePoint Task Force
    • Marked as answer by D_Olin Monday, March 7, 2011 7:33 PM
    Monday, March 7, 2011 3:22 PM
  • Thanks Clayton for your reply!

    Not sure what I am doing here....so please have patience...  :o)    Yes, I give Newbie new meaning since this is the first real thing I have needed to do in SPD.

    I have created up to the "Create Item in" and I am to put in Announcements. Create New List Item window pops. What am I looking at & for & why?

     Thanks,
     D

    *****************************************

    Took a while but I did get it to work!!!  THANKS!

    D

     

     

    • Edited by D_Olin Monday, March 7, 2011 7:34 PM Update
    Monday, March 7, 2011 4:43 PM
  • Thanks Dmitry for the help! Unfortunately, I do not have Visual Studios available at this time and I am at the very beginning stages of learning SharePoint 2010.

    D

    Monday, March 7, 2011 4:47 PM