whitespace COMPANY whitespace SERVICES whitespace PRODUCTS whitespace PURCHASE whitespace SUPPORT whitespace CONTACTS whitespace Home whitespace Contact Us whitespace Site Map whitespace
whitespace
WHY ARTFULBITS
whitespace
OUR APPROACH
whitespace
OUR TEAM
whitespace
FACT SHEET
whitespace
NEWS & EVENTS
whitespace
PRIVACY
whitespace
whitespace

Technical Support Forum

Back to Top
Welcome Guest! To enable all features please Login or Register.

Notification

Icon
Error

Options
View
Go to last post Go to first unread
Viktor Pollack  
#1 Posted : Saturday, October 18, 2014 11:51:59 AM(UTC)
Viktor Pollack
Rank: Newbie

Groups: Registered
Joined: 10/18/2014(UTC)
Posts: 1
Location: London

Hi,
Is it required to activate Email As Attachment for each and every site? If yes, is there is a mechanism allowing for activating it for all libraries?

Thank you in advance!
forumadmin  
#2 Posted : Saturday, October 18, 2014 2:23:47 PM(UTC)
forumadmin
Rank: Administration

Groups: Administrators, Registered
Joined: 7/9/2009(UTC)
Posts: 36

Thanks: 1 times
Hi Viktor,

You are right, Send As Attachment web part should be activated on each library. Certainly sometimes it may become inconvenient, especially in the cases, with the large number of the sites. Please, consider using the following code snippet with this purpose. Also, note, that SPWeb object should correspond to the targeted site.

Code:
using ArtfulBits.EmailAsAttachment;
// located at C:\Windows\Microsoft.NET\assembly\GAC_MSIL\ArtfulBits.EmailAsAttachment\v4.0_1.0.0.0__9b00604759555fc7

SPSecurity.RunWithElevatedPrivileges(delegate() 
 {
foreach (SPWebApplication webApp in SPWebService.ContentService.WebApplications)
            {                    
                foreach (SPSite siteCollection in webApp.Sites)
                {
                    foreach(SPWeb web in siteCollection.RootWeb.GetSubwebsForCurrentUser())
                    {
                       web.AllowUnsafeUpdates = true;
SPListCollection lists = web.Lists;
            foreach (SPList list in lists)
            {
                try
                {
                    EmailAttachSettings settings = EmailAttachSettings.LoadSettings(list);
                    settings.Enabled = true;
                    settings.ShowOnItemEditMenu = true;
                    settings.ShowOnListViewRibbon = true;
                    settings.ShowZipDownloadOnItemEditMenu = true;
                    settings.ShowZipDownloadOnListViewRibbon = true;
                    settings.ShowZipOnItemEditMenu = true;
                    settings.ShowZipOnListViewRibbon = true;
                    settings.Save();
                }
                catch { }
            }
             web.AllowUnsafeUpdates = false;
                    }


                }
            }
  });

ArtfulBits Support Team
Join us on Facebook, Linkedin
Be SharePoint! Be Mobile! Be ArtfulBits!
Users browsing this topic
Guest (2)
Forum Jump  
You cannot post new topics in this forum.
You cannot reply to topics in this forum.
You cannot delete your posts in this forum.
You cannot edit your posts in this forum.
You cannot create polls in this forum.
You cannot vote in polls in this forum.

Company | Services | Practices | Technologies | Career | Contacts | Privacy
© 2005-2017 ArtfulBits. All rights reserved.