.NET Tutorials, Forums, Interview Questions And Answers
Welcome :Guest
Sign In
Register
 
Win Surprise Gifts!!!
Congratulations!!!


Top 5 Contributors of the Month
david stephan
Post New Web Links

Help on SPMetal

Posted By:      Posted Date: September 30, 2010    Points: 0   Category :SharePoint
 

Hi All,

 

I have few Questions on SPMetal uses.

1) After I create Entity class on dev box, How should I use same for QA box? Do I need to regenerate Entity class.

2) Whenever there is changes in List's Columns, Do I need to regenerate Entity class, Whats happens when End user do some changes on List Columns?

3) What happens if change some columns type in Entity class?




View Complete Post


More Related Resource Links

SPMetal and Item Attachments

  
i am currently able to generate the LINQ data class from SpMetal.exe, but i am having a problem how can i generate or modify the SpMetal code to show my Item's Attachments ?    

spmetal generated class and content type (for page layout) retrieve problem

  

I'm working with a console application to generate my sites and subsites (hierarchy). And i've got a problem with a generated spmetal class.

 

this doesn't work:

 

static void Main(string[] args)

        {

            string SITE = string.Concat("http://"Environment.MachineName);         

 

            

SPMetal looping

  

Hi all,

These days I'm deploying a sharepoint solution with code generated by SPMetal to linq sharepoint lists, but now, spmetal is in loop throwing these messages

Backin-up previous version of generated code...

Generating code...

Here is the picture http://twitpic.com/2t4gad

anyone can help-me ?


Teclaman

SPMetal Error: An item with the same key has already been added.

  

I created a Visual Web Part project in VS 2008. Try to create the proxy code for a site using SPmetal. I got this error:

Error: An item with the same key has already been added.

Any idea?

Thanks,

WX


LINQ To SharePoint - SPMetal Issue

  

Hi All,

We an issue with LINQ to SharePoint in creating entities class. Whenever i created the entities class using SPMetal, one or more columns are automatically created in RemoveColumnAttribute something as shown below.

    [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Never)]
    [Microsoft.SharePoint.Linq.RemovedColumnAttribute()]
    public override string Status
    {
      get
      {
        throw new System.InvalidOperationException("Field WorkflowPRStatus was removed from content type.");
      }
      set
      {
        throw new System.InvalidOperationException("Field WorkflowPRStatus was removed from content type ");
      }
    }

Could anyone faced this issue and how to get rid of this Remove

ColumnAttribute?

Any suggestions are welcome.

Thanks

Chandrasekaran C N


Chandrasekaran C N

Why aren't my Scheduling Start/End Date columns picked up by SPMetal?

  

Hi,

I created http://<myserver>/sites/contoso as a publishing site. I then created a list (MyList) and added the existing site columns Scheduling Start Date and Scheduling End Date.

Then, inside VS2010, I ran SPMetal and a nice cs file is added to my project.

Made a nice Linq query:

using

 

 

(DemoDataContext

SPMetal: Using Linq to SharePoint Datacontext to Insert Page

  
Hello,

I am trying to insert a Page (on a Publishing Site) in SharePoint 2010 using the generated SPMetal classes.

Here is the code that I am using to insert a page:

using (var dataContext = new MySharePointSite1L2spDataContext("http://localhost"))
{
  var pages = dataContext.GetList<Page>("Pages");
      
  Page page = new Page();
  page.Title = "New Page";
  page.Name = "Page.aspx";    
  page.Path = "/Pages";
  
  pages.InsertOnSubmit(page);
  dataContext.SubmitChanges();
}

The code results in an NullReferenceException with the details "Object reference not set to an instance of an object."

Stack Trace:
   at Microsoft.SharePoint.Linq.EntityTracker.AddFile(EntityRef eref)
   at Microsoft.SharePoint.Linq.EntityTracker.SubmitNewEntity(NewEntityRef newEref, Stack`1 visited)
   at Microsoft.SharePoint.Linq.EntityTra

a class made from SPmetal breaks windows form designer

  

I created a reportviewer windows form and it builds fine.

When I add a class file made by SPMetal to the project, VS complains that "Error 1 'VacationReport.Form1.Dispose(bool)': no suitable method found to override D:\VacationReport\Form1.Designer.cs 14 33 VacationReport"

Any one knows why?


Ofer Gal

Linq to SharePoint(SPMetal) Missing "Author" and "Editor"

  

So I have also noticed that using the SPMetal tool the CreatedBy(Author) and ModifiedBy(Editor) fields are missing from Entity Model generated by the SPMetal utility. So here is a nice post on manually adding them (http://blogs.microsoft.co.il/blogs/itaysk/archive/2010/02/19/spmetal-missing-created-by-modified-by-fields.aspx), but does anyone know if this is going to be fixed in the future or if there is a reason why they are not generated?

 


Categories: 
ASP.NetWindows Application  .NET Framework  C#  VB.Net  ADO.Net  
Sql Server  SharePoint  Silverlight  Others  All   

Hall of Fame    Twitter   Terms of Service    Privacy Policy    Contact Us    Archives   Tell A Friend