Respondido How to create Wiki page based an passing Id

  • mercoledì 2 maggio 2012 12:20
     
     

    Hi i defined an solution name based on solution automaticle created wikipage also.in programaticle

    thanks

    ps41


    • Modificato PS_L mercoledì 2 maggio 2012 12:21
    •  

Tutte le risposte

  • lunedì 7 maggio 2012 08:21
     
     Con risposta

    Hi ps41,

    Don't quite understood your question, do you mean you want to create Wiki page programmatically?

    If so, you can refer the below thread:
    http://social.msdn.microsoft.com/Forums/en-US/sharepointdevelopment/thread/bb22148f-0636-4b23-a144-03356c74f716/

    Thanks,
    Simon


    Simon Huang

    TechNet Community Support

    • Proposto come risposta Ravi S Kulkarni lunedì 7 maggio 2012 13:42
    • Contrassegnato come risposta Shimin Huang venerdì 11 maggio 2012 06:40
    •  
  • lunedì 7 maggio 2012 13:45
     
     Con risposta Contiene codice

    Hey,

    private void addwikilink(SPWeb web)
            {
                web.AllowUnsafeUpdates = true;
                SPList wiki = web.Lists.TryGetList("TeamWiki");
                //trygetlist:Returns the list with the specified title from the collection, but returns null instead of an exception if the list does not exist
                SPFolder rootFolder = wiki.RootFolder;
                SPFile wikiPage = rootFolder.Files.Add(String.Format("{0}/{1}", rootFolder.ServerRelativeUrl, "Home.aspx"), SPTemplateFileType.WikiPage); 
                
               
                SPListItem wikiItem1 = wikiPage.Item;
                
                StringBuilder sb = new StringBuilder("");
               
                sb.Append("<table id='layoutsTable' style='width:100%'><tbody><tr><td><div class='ms-rte-layoutszone-outer' style='width:99.9%'>");
                sb.Append("<div class='ms-rte-layoutszone-inner' style='min-height:60px;word-wrap:break-word'><div><strong class='ms-rteFontSize-3'>Welcome to your wiki library!</strong><br />");
                sb.Append("<div id='divCont'> You can get started and add content to this page by clicking ");
    
                sb.Append("<b>Edit</b> at the top of this page, or you can learn more about wiki libraries by clicking [[How To Use This Library]] </div><br/>");
                sb.Append("<i>Wikiwiki</i> means quick in Hawaiian. A wiki library is a document library in which users can easily edit any page. The library grows organically by linking existing pages together or by creating links to new pages. If a user finds a link to an uncreated page, he or she can follow the link and create the page.<br /><br />");
                sb.Append("In business environments, a wiki library provides a low-maintenance way to record knowledge. Information that is usually traded in e-mail messages, gleaned from hallway conversations, or written on paper can instead be recorded in a wiki library, in context with similar knowledge.<br /><br />");
                sb.Append("Other example uses of wiki libraries include brainstorming ideas, collaborating on designs, creating an instruction guide, gathering data from the field, tracking call center knowledge, and building an encyclopedia of knowledge.</div></div></div></td></tr></tbody></table>");
          
               
                
                wikiItem1[SPBuiltInFieldId.WikiField] = sb.ToString();
    
              
                wikiItem1.UpdateOverwriteVersion();
              
                web.Update();
                web.AllowUnsafeUpdates = false;
            }

    This wil create default OOB "Home.aspx"  bt through programatically :)

    Let me know if you ahve any queries :)


    "The Only Way To Get Smarter Is By Playing A Smarter Opponent"

    • Contrassegnato come risposta Shimin Huang venerdì 11 maggio 2012 06:40
    •