Answered Issue with Custom site template

  • quarta-feira, 3 de março de 2010 13:04
     
     

    Hello Every One

         I have use Sharepoint Foundation 2010 with VS 2010  ,
    if i create new Site with Custom Site template, site will be created but in this new site i goto add new List then Create List From Give Error .

    "An error occurred while getting items from the "" Provider:
     Cannot complete this action.
     Please try again."

    if i see in event viewer give this message

    3006
        A parser error has occurred.
        3/3/2010 5:01:00 AM
        3/3/2010 1:01:00 PM
        8881dca036bb4b82830233c931b7b0b2
        2481
        151
        0
        /LM/W3SVC/968580155/ROOT-1-129120892813851515
        WSS_Minimal
        /
        C:\inetpub\wwwroot\wss\VirtualDirectories\80\
        EWP-SPDEV2
         
        3884
        w3wp.exe
        NT AUTHORITY\NETWORK SERVICE
        HttpParseException
        Unknown server tag 'WebPartPages:WebPartZone'.
        http://ewp/sites/sp2010/ns/etc/firstpage.aspx
        /sites/sp2010/ns/etc/firstpage.aspx
        fe80::7dbe:59b5:d028:31cc%11
        NT AUTHORITY\LOCAL SERVICE
        True
        NTLM
        NT AUTHORITY\NETWORK SERVICE
        13
        NT AUTHORITY\NETWORK SERVICE
        True
        at System.Web.UI.TemplateParser.ParseString(String text, VirtualPath virtualPath, Encoding fileEncoding) at System.Web.UI.TemplateParser.ParseFile(String physicalPath, VirtualPath virtualPath) at System.Web.UI.TemplateParser.ParseInternal() at System.Web.UI.TemplateParser.Parse() at System.Web.Compilation.BaseTemplateBuildProvider.get_CodeCompilerType() at System.Web.Compilation.BuildProvider.GetCompilerTypeFromBuildProvider(BuildProvider buildProvider) at System.Web.Compilation.BuildProvidersCompiler.ProcessBuildProviders() at System.Web.Compilation.BuildProvidersCompiler.PerformBuild() at System.Web.Compilation.BuildManager.CompileWebFile(VirtualPath virtualPath) at System.Web.Compilation.BuildManager.GetVPathBuildResultInternal(VirtualPath virtualPath, Boolean noBuild, Boolean allowCrossApp, Boolean allowBuildInPrecompile) at System.Web.Compilation.BuildManager.GetVPathBuildResultWithNoAssert(HttpContext context, VirtualPath virtualPath, Boolean noBuild, Boolean allowCrossApp, Boolean allowBuildInPrecompile) at System.Web.Compilation.BuildManager.GetVirtualPathObjectFactory(VirtualPath virtualPath, HttpContext context, Boolean allowCrossApp, Boolean noAssert) at System.Web.Compilation.BuildManager.CreateInstanceFromVirtualPath(VirtualPath virtualPath, Type requiredBaseType, HttpContext context, Boolean allowCrossApp, Boolean noAssert) at System.Web.UI.PageHandlerFactory.GetHandlerHelper(HttpContext context, String requestType, VirtualPath virtualPath, String physicalPath) at System.Web.HttpApplication.MaterializeHandlerExecutionStep.System.Web.HttpApplication.IExecutionStep.Execute() at System.Web.HttpApplication.ExecuteStep(IExecutionStep step, Boolean& completedSynchronously)

Todas as Respostas

  • quarta-feira, 3 de março de 2010 21:50
     
     

    Hi Navaratan,

    Can you please give more details to better understand your scenario:

    • What build of VS and SharePoint do you have?
    • Are you using the Site Definition template or WSP Import template to deploy the new SiteTemplate through VS?
    • What modifications (if any) do you make to the template files before deploying them.
    • Which list are you trying to create?

    ------------------------------------------------------------
    Mujahid Hasan-MSFT
    SDE, Visual Studio

  • quinta-feira, 4 de março de 2010 05:37
     
     

    Hello Mujahid Hasan

               Thank's for replay

                      i have use Microsoft Visual Studio 2010 Professional , SharePoint 2010  With SharePoint Foundation 2010 SDk.
                     i use Site Definition template for New Site Defination. i create new Custom List by Code.

  • sexta-feira, 5 de março de 2010 02:05
     
     
    Hi Navaratan,

    Is it the Beta2 build of VS and Beta2 SharePoint 2010?

    Can you share the code you use to create the list?

    Regards,
    Mujahid Hasan-MSFT
    SDE, Visual Studio
    This posting is provided "AS IS" with no warranties, and confers no rights.
  • sábado, 6 de março de 2010 06:21
     
     

    Hello Mr. Mujahid Hasan

          Yes it is Beta2.

     My code is for creating a list is

     

    using System;
    using System.Collections.Generic;
    using System.Linq;
    using System.Text;
    using Microsoft.SharePoint;
    using System.Xml;
    using System.Web.UI.WebControls;

    namespace CPM.Lists {
    class ProjectIssueCategoryClient {
    private const String _listName = "Project Issue Category";
    public void CreateList(SPWeb siteFeature, bool parentSite) {
    CommonListMethods commonListMethods = new CommonListMethods();
    SPList list = commonListMethods.CreateList(siteFeature, _listName, _listName, (int)CommonEnums.EntityType.ProjectIssueCategory, SPListTemplateType.GenericList, parentSite);
    list.OnQuickLaunch = false;
    if (list != null) {
    AddListFields(ref list);
    }
    commonListMethods = null;
    }

    private void AddListFields(ref SPList projectIssueCategoryList) {
    CPM.Lists.CommonListMethods commonListMethods = new CPM.Lists.CommonListMethods();
    projectIssueCategoryList.Fields.Add("Issue Category ID", SPFieldType.Guid, false);
    projectIssueCategoryList.Fields["Issue Category ID"].StaticName = "CustomssueCategoryID";
    projectIssueCategoryList.Fields["Issue Category ID"].Hidden = true;
    projectIssueCategoryList.Fields["Issue Category ID"].Update();
    SPField title = projectIssueCategoryList.Fields["Title"];
    title.Title = "Issue Category Title";
    title.Update();
    projectIssueCategoryList.Fields.Add("Created By", SPFieldType.Text, false);
    projectIssueCategoryList.Fields["Created By"].StaticName = "CustomCreatedBy";
    projectIssueCategoryList.Fields["Created By"].Hidden = true;
    projectIssueCategoryList.Fields["Created By"].Update();
    projectIssueCategoryList.Fields.Add("Modified By", SPFieldType.Text, false);
    projectIssueCategoryList.Fields["Modified By"].StaticName = "CustomModifiedBy";
    projectIssueCategoryList.Fields["Modified By"].Hidden = true;
    projectIssueCategoryList.Fields["Modified By"].Update();
    projectIssueCategoryList.Fields.Add("Created Date", SPFieldType.DateTime, false);
    projectIssueCategoryList.Fields["Created Date"].StaticName = "CustomCreatedDate";
    projectIssueCategoryList.Fields["Created Date"].Hidden = true;
    projectIssueCategoryList.Fields["Created Date"].Update();
    projectIssueCategoryList.Fields.Add("Modified Date", SPFieldType.DateTime, false);
    projectIssueCategoryList.Fields["Modified Date"].StaticName = "CustomModifiedDate";
    projectIssueCategoryList.Fields["Modified Date"].Hidden = true;
    projectIssueCategoryList.Fields["Modified Date"].Update();
    projectIssueCategoryList.Fields.Add("Company ID", SPFieldType.Guid, false);
    projectIssueCategoryList.Fields["Company ID"].StaticName = "CustomCompanyID";
    projectIssueCategoryList.Fields["Company ID"].Hidden = true;
    projectIssueCategoryList.Fields["Company ID"].Update();
    projectIssueCategoryList.Fields.Add("Web ID", SPFieldType.Guid, false);
    projectIssueCategoryList.Fields["Web ID"].StaticName = "CustomWebID";
    projectIssueCategoryList.Fields["Web ID"].Hidden = true;
    projectIssueCategoryList.Fields["Web ID"].Update();
    projectIssueCategoryList.Fields.Add("Parent Type", SPFieldType.Guid, false);
    projectIssueCategoryList.Fields["Parent Type"].StaticName = "CustomParentType";
    projectIssueCategoryList.Fields["Parent Type"].Hidden = true;
    projectIssueCategoryList.Fields["Parent Type"].Update();
    projectIssueCategoryList.Fields.Add("Parent Type ID", SPFieldType.Guid, false);
    projectIssueCategoryList.Fields["Parent Type ID"].StaticName = "CustomParentTypeID";
    projectIssueCategoryList.Fields["Parent Type ID"].Hidden = true;
    projectIssueCategoryList.Fields["Parent Type ID"].Update();
    projectIssueCategoryList.Fields.Add("IssueCategoryURL", SPFieldType.Text, false);
    projectIssueCategoryList.Fields["IssueCategoryURL"].StaticName = "CustomIssueCategoryURL";
    projectIssueCategoryList.Fields["IssueCategoryURL"].Hidden = true;
    projectIssueCategoryList.Fields["IssueCategoryURL"].Update();
    projectIssueCategoryList.Update();
    commonListMethods.CreateView(ref projectIssueCategoryList);
    commonListMethods = null;
    }

    }

    }

    ===============And code of  CommonListMethods Is=========

    private SPListTemplateType _listTemplateType = SPListTemplateType.GenericList;
    public SPList CreateList(SPWeb siteFeature, String listName, String listDesc, int entityType, SPListTemplateType listTemplateType, bool ParentSite) {
    _listTemplateType = listTemplateType;
    return CreateList(siteFeature, listName, listDesc, entityType, ParentSite);
    }
    public SPList CreateList(SPWeb siteFeature, String listName, String listDesc, int entityType, bool ParentSite) {
    if (siteFeature != null) {
    using (SPWeb web = siteFeature as SPWeb) {
    web.Lists.Add(listName, listDesc, _listTemplateType);
    web.Update();
    SPList list = web.Lists[listName];
    list.OnQuickLaunch = true;
    string asmName = "CPM, Version = 1.0.0.0, Culture = Neutral, PublicKeyToken = 9da0380695a90b73";
    string className = "CPM.Lists.ListItemEventReceiver";
    list.EventReceivers.Add(SPEventReceiverType.ItemAdding, asmName, className);
    list.EventReceivers.Add(SPEventReceiverType.ItemUpdating, asmName, className);
    list.Update();
    list.EventReceivers.Add(SPEventReceiverType.ItemAdded, asmName, className);
    list.EventReceivers.Add(SPEventReceiverType.ItemUpdated, asmName, className);
    list.EventReceivers.Add(SPEventReceiverType.ItemDeleted, asmName, className);
    list.Update();
    list.EventReceivers.Add(SPEventReceiverType.ItemDeleting, asmName, className);
    list.Update();
    web.Dispose();
    return list;
    }
    }
    return null;
    }

  • quarta-feira, 10 de março de 2010 02:20
     
     
    Hi Navaratan,

    Unfortunately it is hard to figure out why your project is failing. Is it possible for you to email your solution as a zip file to me for further investigation at: mujahidh [at] microsoft.com

    ------------------------------------------------------------
    Mujahid Hasan-MSFT
    SDE, Visual Studio
    This posting is provided "AS IS" with no warranties, and confers no rights.
  • quarta-feira, 17 de março de 2010 09:43
     
     
    Hi All,

    I am having exactly the same problem, has someone already found a solution for this issue?
  • quarta-feira, 17 de março de 2010 13:44
     
     Respondido
    I came across this website, with I think the solution to your problem:

    Problem with VS2010 beta 2 Site Definition

    Hope it helps.
    • Sugerido como Resposta Sp1ffy quarta-feira, 17 de março de 2010 15:10
    • Marcado como Resposta Navaratan quinta-feira, 18 de março de 2010 04:40
    •  
  • quarta-feira, 17 de março de 2010 15:11
     
     
    Thank you r.burgundy! That solved the problem for me... thx!
  • quarta-feira, 24 de março de 2010 06:56
     
     

    Hello this is realy work.

    After creating the new Site Definition Project in the onet.xml file contains the following:


    <?xml version="1.0" encoding="utf-8"?>
    <Project Title="SampleSiteDefinition" Revision="2" ListDir="" xmlns:ows="Microsoft SharePoint" xmlns="http://schemas.microsoft.com/sharepoint/">
      <NavBars>
      </NavBars>
      <Configurations>
        <Configuration ID="0" Name="SampleSiteDefinition">
          <Lists/>
          <SiteFeatures>
          </SiteFeatures>
          <WebFeatures>
          </WebFeatures>
          <Modules>
            <Module Name="DefaultBlank" />
          </Modules>
        </Configuration>
      </Configurations>
      <Modules>
        <Module Name="DefaultBlank" Url="" Path="">
          <File Url="default.aspx">
          </File>
        </Module>
      </Modules>
    </Project>


    Now you can modify to the onet.xml and default.aspx as you like.

    When deploying the new Site Definition, creating a site, and then trying to create a new Document Library you get the error above.  The solution for the error turned out to be the missing declaration of the <DocumentTemplates> XML node.

    Correct default onet.xml should be:

    <?xml version="1.0" encoding="utf-8"?>
    <Project Title="SampleSiteDefinition" Revision="2" ListDir="" xmlns:ows="Microsoft SharePoint" xmlns="http://schemas.microsoft.com/sharepoint/">
      <NavBars>
      </NavBars>
      <DocumentTemplates>
      </DocumentTemplates>
      <Configurations>
          <Lists/>
          <SiteFeatures>
          </SiteFeatures>
          <WebFeatures>
          </WebFeatures>
          <Modules>
            <Module Name="DefaultBlank" />
          </Modules>
        </Configuration>
      </Configurations>
      <Modules>
        <Module Name="DefaultBlank" Url="" Path="">
          <File Url="default.aspx">
          </File>
        </Module>
      </Modules>
    </Project>
    After re-deploying the Site Definition and creating a new Site, you are able to create a Document Library.

    Thnaks Mr.  r.burgundy for your help.