Simple coding to quickly unify site themes

Source: Internet
Author: User
Moss2007 is really a good thing. It has many built-in themes and is very beautiful. Over time, there may be a need to change the themes. It's okay to have fewer sites. After a long time, many sites have been created, if you want me to change through site settings one by one, it will be miserable. Fortunately, moss2007 provides a good programming interface that can replace topics in batches in just a few words. Code .

1 Using System;
2 Using System. Collections. Generic;
3 Using System. text;
4 Using Microsoft. SharePoint;
5
6 Namespace Setallwebtheme
7 {
8 Class Program
9 {
10 Static   Void Main ( String [] ARGs)
11 {
12 If (ARGs. Length =   2 )
13 {
14 Spsite SPS =   Null ;
15
16 Try
17 {
18SPS= NewSpsite (ARGs [1]);
19}
20 Catch (Exception E)
21 {
22Console. writeline (E. Message );
23Return;
24}
25
26 If (ARGs [ 0 ] =   " List " )
27 {
28 Foreach (Spweb spw In SPs. allwebs)
29 Console. Write ( " Web Name: {0} \ nweb theme: {1} \ Ntitle: {2} \ n " , Spw. Name, spw. Theme, spw. Title );
30
31 }
32 Else
33 {
34 Foreach (Spweb spw In SPs. allwebs)
35 {
36 Try
37 {
38 Spw. applytheme (ARGs [ 0 ]);
39 Console. Write ( " Application {0} topic to {1} site \ n " , Spw. Theme, spw. Title );
40 }
41 Catch (Exception E)
42 {
43Console. writeline (E. Message );
44}
45 }
46 }
47
48 SPs. Dispose ();
49 }
50 Else
51 {
52 Console. writeline ( " Batch set moss2007 site themes " );
53 Console. writeline ( " Author: booolee) " );
54 Console. writeline ( " Http://booolee.cnblogs.com " );
55 Console. writeline ( " Usage: setallwebtheme arg1 arg2 " );
56 Console. writeline ( " When arg1 is set to list, all web pages in the specified URL are listed. " );
57 Console. writeline ( " When arg1 is the primary title (English topic name), it is the name of the topic to be set. " );
58 Console. writeline ( " Arg2 is the URL of the specified site. " );
59 Console. writeline ( " Example: setallwebtheme http: // SharePoint " );
60 Console. writeline ( " List summary information of all web pages under http: // SharePoint " );
61 Console. writeline ( " Example: setallwebtheme lichen http: // SharePoint " );
62 Console. writeline ( " Set all site themes under http: // Sharepoint to liclic " );
63 }
64
65 }
66 }
67 }
68

I have compiled this tool. You can download it for free ~~
You can download http://files.cnblogs.com/booolee/SetAllWebTheme.rar from this address

Copy the tool to the moss server and run it without parameters.

The English topic name is the name in the moss topic list in English version.

With this tool, you can change themes in batches at any time ~~

The code is provided to you. You can perform a moss theme show by randomly changing the theme over a period of time. For Windows, you can use the theme show software or moss ~

Nonsense time:
I had a quarrel with my wife yesterday, but it wasn't because of any major issues. I really shouldn't want to come back today. I'm sorry to my wife here. Don't go to my heart ~~

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.