visual studio Bing Code Search

Bing Code Search for Visual Studio 2013 helps developers find and reuse code samples on the web more easily by bringing the code search experience directly into Visual Studio. With this extension, a developer can search sites such as MSDN, Stack Overflow, CSharp411 and Dotnetperls and find, copy and use C# code samples directly inside the IDE. Bing Code Search works currently for C# solutions only, more languages to follow.All the snippets in the index were automatically checked to ensure they compile, but in the search, the algorithms also look at votes from the given community that the snippet comes from and other quality signals. The best thing, though, is that it doesn’t just copy and paste the snippet into the code, but it will also try to modify the code to fit the variables you already use in your own code. Even if you don’t have Visual Studio installed, you can try a web-based version (with a slightly different interface) here. Here is a video demonstration of the Bing search add-on   Source: http://blogs.msdn.com/b/visualstudio/archive/2014/02/17/introducing-bing-code-search-for-c.aspx

Hiding SharePoint Lists

Sometimes we do feel a need to hide SharePoint Lists. Following are few ways which could some in handy while trying to achieve this objective.
Using SharePoint Designer:

  1. Start SharePoint Designer and open your site.
  2. Click on the “Lists and Libraries” in the Navigation pane
  3. Select the list/library which you need to hide
  4. On the details page check the “Hide from browser” checkbox and save
  5. To unhide the list un-check the checkbox and save 
sharepoint designer
SharePoint Designer

Using Code:
The other way is to obviously do this through code. SPList has a property as Hidden which can be set to true or false

using (SPSite site = new SPSite("http://YourSiteUrl"))
                {
                    using (SPWeb web = site.OpenWeb())
                    {
                        SPList list = web.Lists["Announcements"];
                        //Set this property to true or false accordingly
                        list.Hidden = false;
                        list.Update();
                    }
                }

Enable Incoming email inside a SharePoint list

SharePoint provides a functionality where lists can be configured to receive and store emails. Let us look at how we can do this from SharePoint UI as well as code

From UI:

  • Navigate to the list for which you want to enable and configure incoming e-mail support.
  • Click Settings, and then click List Settings.
  • Under Communications, click Incoming e-mail settings. (The Incoming e-mail settings link is available only if incoming e-mail support is not enabled in Central Administration.)
  • In the E-Mail section, choose Yes to enable this list to receive e-mail, and then type the alias that you want to use to send e-mail to this list.
  • In the E-Mail Attachments section, choose whether you want to archive the e-mail attachments in this list.
  • In the E-Mail Message section, choose whether to save the original e-mail in this list. (If you choose Yes, the original e-mail is saved as an attachment.)
  • In the E-Mail Meeting Invitations section, choose whether to archive meeting invitations that were sent as e-mail in this list.
  • In the E-Mail Security section, choose whether to accept e-mail from only members of the site who can write to the list or to accept e-mail regardless of who sends the e-mail.
From Code:

SPSite site = new SPSite("{yoursite"});
            SPWeb web =  site.OpenWeb();
            
            SPList list = site.Lists[listGuid];

            list.ContentTypesEnabled = true;            
            list.EnableAssignToEmail = true;
            list.EmailAlias = myText.Text;
            list.Update();

            //Group attachments in folders, options: "subject"/ "sender"/ "root"
            list.RootFolder.Properties["vti_emailattachmentfolders"] = "sender";
           
            
            //Options 1=true 0=false
            list.RootFolder.Properties["vti_emailoverwrite"] = 0;                  
            
            list.RootFolder.Properties["vti_emailusesecurity"] = 0;
            
            list.RootFolder.Properties["vti_emailsaveattachments"] = 1;

            list.RootFolder.Properties["vti_emailsaveoriginal"] = 1;                
            
            list.RootFolder.Properties["vti_emailsavemeetings"] = 0;                
            
            list.RootFolder.Properties["vti_emailusesecurity"] = 1;                
             
            list.RootFolder.Update();