Cannot implicitly convert type 'Microsoft.SharePoint.SPListItemCollection' to 'System.Collections.Generic.List T '_

Hi
I want use SPListItemCollection' to 'System.Collections.Generic.List<T>'.
How to achieve this.
Thanks,
Siva.

Hi Siva,
This is how I code it for looping all SPListItem in the SPListItemCollection using Generic List<T>
public IEnumerable GetEnumerator()
using (SPSite site = new SPSite(SPContext.Current.Site.Url))
using (SPWeb web = site.OpenWeb())
var list = web.Lists["Friends"];
var query = new SPQuery();
query.Query = "<FieldRef Name='ID'/>";
IEnumerable items = list.GetItems(query);
return items;
Then calling the method would be
var items = GetEnumerator();
foreach(SPListItem item in items)
Response.Write(item["FirstName"]);
Murugesa Pandian| MCPD | MCTS |SharePoint 2010

Similar Messages

  • Cannot implicitly convert type 'System.Data.SqlClient.SqlDataReader' to 'Microsoft.ReportingServices.DataProcessing.IDataReader'. An explicit conversion exists (are you missing a cast?)

    Cannot implicitly convert type 'System.Data.SqlClient.SqlDataReader' to 'Microsoft.ReportingServices.DataProcessing.IDataReader'. An explicit conversion exists (are you missing a cast?)
    I am getting the above error in c#. Please help me. Thanks in advance
    public IDataReader ExecuteReader(CommandBehavior behavior)
    string query = "select * from Sales.Store";
    SqlConnection readerconn = new SqlConnection("Data Source=localhost;Initial Catalog=AdventureWorks2000;Integrated Security=SSPI");
    SqlCommand readercmd = new SqlCommand(query);
    try
    readerconn.Open();
    readercmd = readerconn.CreateCommand();
    readercmd.CommandText = query;
    readercmd.CommandType = System.Data.CommandType.Text;
    SqlDataReader TestReader = readercmd.ExecuteReader();
    return TestReader; //Getting error at this line
    readerconn.Close();
    catch (Exception e)
    throw new Exception(e.Message);

    Hi,
    Please firstly take a look at the documentation:
    IDbCommand.ExecuteReader
    Method
    Users do not create an   instance of a
    DataReader   class directly. Instead, they obtain the
    DataReader   through the
    ExecuteReader   method of the Command   object. Therefore, you should mark
    DataReader   constructors as internal.
    You need to use this method to get the IDataReader object, all the IDbCommand and IDataReader are in the Microsoft.ReportingServices.DataProcessing namespace. There's another IDataReader object which is in System.Data namespace, but they're actually two different
    objects, that's why you got the exception.
    For how to properly implement this Microsoft.ReportingServices.DataProcessing.IDataReader, please check this documentation:
    Implementing a DataReader Class for a Data Processing Extension
    It also provides code samples there.
    We are trying to better understand customer views on social support experience, so your participation in this interview project would be greatly appreciated if you have time. Thanks for helping make community forums a great place.
    Click
    HERE to participate the survey.

  • Systems.Collections.Generic.List T Requires 1 Type of Argument?

    I am having troubles with my code. I am trying to start a list entitles "studentList" and it is supposed to allow the user to enter in a list of student names and their ages. 
    Below is my code and this is a windows Forms:
    <code>
    List<Student> studentList = new List();
            private void btnAddStudent_Click(object sender, EventArgs e)
            private void btnShowStudents_Click(object sender, EventArgs e)
                List<Student> sortedList = studentList.OrderBy(o => o.LastName).
                                                  ThenBy(o => o.FirstName).ToList();
                String outputStr = "";
                foreach (Student s in sortedList)
                    if (outputStr != "")
                        outputStr += "\n--------------\n";
                    outputStr += s.ToString();
                if (outputStr == "")
                    outputStr = "No Student Records Yet!";
                MessageBox.Show(outputStr);
    </code>
    I have other code as well but this is the problem area. I am getting a Systems.Collections.Generic.List<T> Requires 1 Type of Argument error on this line of code: List<Student> studentList = new List(); and I cannot figure out why.
    If I change it to List<string>studentList = new List<string>(); I get an error later on in the code.
    I'm sorry if this is confusing but this is a really complex assignment that I've been working on for hours and I'm completely frustrated because I'm so close to finishing.
    Any help would be appreciated!
    Thanks :)

    I am having troubles with my code.
    If you post this to a C# and not to a VB forum, you'll have the chance all your troubles are gone. :)
    https://social.msdn.microsoft.com/Forums/vstudio/en-US/home?forum=csharpgeneral
    Armin

  • Cannot implicitly convert type 'int' to 'DocumentFormat.OpenXml.StringValue'

    Hi,
    I have a write code-behind in infopath form to convert word document using openXML
    Below code i have used to convert:
    I underlined the code which is getting error!!!
    using Microsoft.Office.InfoPath;
    using System;
    using System.Xml;
    using System.Xml.XPath;
    using System.IO;
    using System.Text;
    using DocumentFormat.OpenXml.Packaging;
    using DocumentFormat.OpenXml.Wordprocessing;
    namespace SampleForm
        public partial class FormCode
            // Member variables are not supported in browser-enabled forms.
            // Instead, write and read these values from the FormState
            // dictionary using code such as the following:
            // private object _memberVariable
            //     get
            //         return FormState["_memberVariable"];
            //     set
            //         FormState["_memberVariable"] = value;
            // NOTE: The following procedure is required by Microsoft InfoPath.
            // It can be modified using Microsoft InfoPath.
            private TableCell createCell(string content)
                // Create a new table cell
                TableCell tc = new TableCell();
                // Specify the width of the table cell
                TableCellWidth tcw = new TableCellWidth();
                tcw.Width = 2400;
                tcw.Type = TableWidthUnitValues.Dxa;
                tc.Append(new TableCellProperties(tcw));
                // Specify the content of the table cell
                tc.Append(new Paragraph(new Run(new Text(content))));
                // Return the new table cell
                return tc;
            private TableRow createRow(string cell1, string cell2, string cell3)
                // Create a new table row
                TableRow tr = new TableRow();
                // Add the table cells to the table row
                tr.Append(createCell(cell1));
                tr.Append(createCell(cell2));
                tr.Append(createCell(cell3));
                // Return the new table row
                return tr;
            public void InternalStartup()
                ((ButtonEvent)EventManager.ControlEvents["CTRL6_5"]).Clicked += new ClickedEventHandler(CTRL6_5_Clicked);
            public void CTRL6_5_Clicked(object sender, ClickedEventArgs e)
                // Write your code here.
                // Get a reference to the main data source
                XPathNavigator root = MainDataSource.CreateNavigator();
                // Copy the template and create a new document
                string newFilePath = @"C:\NewDoc.docx";
                File.Copy(@"C:\QuickQuote.docx", newFilePath, true);
                using (WordprocessingDocument myDoc =
                WordprocessingDocument.Open(newFilePath, true))
                    // Add an aFChunk part to the package
                    string altChunkId = "AltChunkId1";
                    MainDocumentPart mainPart = myDoc.MainDocumentPart;
                    AlternativeFormatImportPart chunk = mainPart
                    .AddAlternativeFormatImportPart(
                    AlternativeFormatImportPartType.Xhtml, altChunkId);
                    // Retrieve the rich text field contents
                    // and store it into the aFChunk part
                    StringBuilder sb = new StringBuilder();
                    sb.Append("<html>");
                    sb.Append(root.SelectSingleNode(
                    "//my:RtxtField", NamespaceManager).InnerXml);
                    sb.Append("</html>");
                    string html = sb.ToString();
                    using (MemoryStream ms =
                    new MemoryStream(Encoding.UTF8.GetBytes(html)))
                        chunk.FeedData(ms);
                    // Add the aFChunk to the document
                    AltChunk altChunk = new AltChunk();
                    altChunk.Id = altChunkId;
                    mainPart.Document.Body.Append(altChunk);
                    // Create an empty table and specify formatting for its borders
                    Table table = new Table();
                    TableBorders borders = new TableBorders();
                    TopBorder tb = new TopBorder();
                    tb.Val = new DocumentFormat.OpenXml
                    .EnumValue<BorderValues>(BorderValues.Dashed);
                    tb.Size = 24;
                    borders.AppendChild<TopBorder>(tb);
                    BottomBorder bb = new BottomBorder();
                    bb.Val = new DocumentFormat.OpenXml
                    .EnumValue<BorderValues>(BorderValues.Dashed);
                    bb.Size = 24;
                    borders.AppendChild<BottomBorder>(bb);
                    LeftBorder lb = new LeftBorder();
                    lb.Val = new DocumentFormat.OpenXml
                    .EnumValue<BorderValues>(BorderValues.Dashed);
                    lb.Size = 24;
                    borders.AppendChild<LeftBorder>(lb);
                    RightBorder rb = new RightBorder();
                    rb.Val = new DocumentFormat.OpenXml
                    .EnumValue<BorderValues>(BorderValues.Dashed);
                    rb.Size = 24;
                    borders.AppendChild<RightBorder>(rb);
                    InsideHorizontalBorder ihb = new InsideHorizontalBorder();
                    ihb.Val = new DocumentFormat.OpenXml
                    .EnumValue<BorderValues>(BorderValues.Single);
                    ihb.Size = 24;
                    ihb.Color = new DocumentFormat.OpenXml.StringValue("#FF0000");
                    borders.AppendChild<InsideHorizontalBorder>(ihb);
                    InsideVerticalBorder ivb = new InsideVerticalBorder();
                    ivb.Val = new DocumentFormat.OpenXml
                    .EnumValue<BorderValues>(BorderValues.Dashed);
                    ivb.Size = 24;
                    borders.AppendChild<InsideVerticalBorder>(ivb);
                    TableProperties tblProp = new TableProperties(borders);
                    table.AppendChild<TableProperties>(tblProp);
                    // Loop through the repeating table and create rows in the table
                    XPathNodeIterator iter = root.Select("//my:group2",
                    NamespaceManager);
                    while (iter.MoveNext())
                        string cell1 = iter.Current.SelectSingleNode(
                        "my:cell1", NamespaceManager).Value;
                        string cell2 = iter.Current.SelectSingleNode(
                        "my:cell2", NamespaceManager).Value;
                        string cell3 = iter.Current.SelectSingleNode(
                        "my:cell3", NamespaceManager).Value;
                        TableRow tr = createRow(cell1, cell2, cell3);
                        table.Append(tr);
                    // Add the table to the document
                    mainPart.Document.Body.Append(table);
                    // Save the document
                    mainPart.Document.Save();

    Hello Coolsweety,
    Maybe this technet article is useful, at the end I see how they specify the width property:
    http://msdn.microsoft.com/en-us/library/office/cc850841(v=office.15).aspx
    - Dennis | Netherlands | Blog |
    Twitter

  • How to solve this Error?? Error_2_Cannot implicitly convert type 'int' to 'int[]'_

    Hi,
    I created a structure. It contains 1& 2 diamensional arrays. Now I want to pass values to these arrays. But at that time I got the following error.
        Error 2 Cannot implicitly convert type 'int' to 'int[]' 
            publicstructtest
              [FieldOffset(160)]
             [MarshalAs(UnmanagedType.ByValArray,
    SizeConst = 3)]
            publicint[]
    DC;
               [FieldOffset(168)]
              [MarshalAs(UnmanagedType.ByValArray,
    SizeConst = 8)]
              publicfloat[]
    IN;
               [FieldOffset(176)]
              [MarshalAs(UnmanagedType.ByValArray,
    SizeConst = 8)]
            publicbyte[,]
    us;
    privatevoidbutton1_Click(objectsender,
    EventArgse)
    //int[] T_ADC = new int[3];
                array[0].DC =12
                array[0].IN[0] = 11;
                array[0].us[0, 0] = 1;

    @DAANNIII
    >>I wrote the code as follows
    array[0].DC[0]
    =12
    but after that I got an error that  " Object reference not set to an instance of an object".Why this type of error occurs??
    Still confused about how you define variable "array[0]".
    Based on your error information, because your DC is null. As I said before, DC is an int[]. You must assign an array to DC.
    int[] array = new int[] { 2, 43 };
    test s = new test();
    s.DC = array;
    s.DC[0] = 12;//It works fine
    Best regards,
    Kristin
    We are trying to better understand customer views on social support experience, so your participation in this interview project would be greatly appreciated if you have time. Thanks for helping make community forums a great place.
    Click
    HERE to participate the survey.

  • Cannot covert type 'Microsoft.SharePoint.Client.WebParts.WebPart' to 'GenericSmartPart.SmartPart'

    Hi Concern,
    I am using Client Site CSOM coding and getting error
    Smart Parts user control detail is required and while converting throws error.
    Cannot covert type ‘Microsoft.SharePoint.Client.WebParts.WebPart’ to ‘GenericSmartPart.SmartPart’
    Code is associted as problem.
    using System;
    using System.Collections.Generic;
    using System.Linq;
    using System.Text;
    using Microsoft.SharePoint.Client;
    using Microsoft.SharePoint.Client.WebParts;
    using Microsoft.SharePoint.Client.Utilities;
    using System.Data;
    namespace TrainingCsharp
    class Class1
    public void print()
    // Starting with ClientContext, the constructor requires a URL to the
    // server running SharePoint.
    using (ClientContext context = new ClientContext("Site URL "))
    // The SharePoint web at the URL.
    Web web = context.Web;
    // We want to retrieve the web's properties.
    // context.Load(web, w => w.Title, w => w.Description);
    context.Load(web, w => w.Title, w => w.Description, w => w.ServerRelativeUrl);
    context.ExecuteQuery();
    string sUrl= web.ServerRelativeUrl;
    File oFile = context.Web.GetFileByServerRelativeUrl(sUrl+"/Pages/default.aspx");
    LimitedWebPartManager limitedWebPartManager = oFile.GetLimitedWebPartManager(PersonalizationScope.Shared);
    context.Load(limitedWebPartManager.WebParts,
    wps => wps.Include(
    wp => wp.WebPart.Title, wp => wp.WebPart.ZoneIndex ));
    context.ExecuteQuery();
    int count = limitedWebPartManager.WebParts.Count;
    string[] arr, arr1;
    if (count == 0)
    Console.WriteLine("No Web Parts on this page.");
    else
    arr = new string[count];
    arr1 = new string[count];
    string sControlName = null;
    for (int i = 0; i < count; i++)
    WebPartDefinition oWebPartDefinition = limitedWebPartManager.WebParts[i];
    WebPart oWebPart = oWebPartDefinition.WebPart;
    arr[i] = oWebPart.Title;
    if (arr[i].ToLower().Contains("generic"))
    sControlName = ((GenericSmartPart.SmartPart)(oWebPart)).UserControlPath;
    //else if (arr[i].ToLower().Contains("smartpart"))
    //sControlName = ((SmartPart.SmartPart)(oWebPart)).UserControl;
    //else if (arr[i].EndsWith("ListViewWebPart"))
    //sControlName = ((Microsoft.SharePoint.Client.ListItemCollection)(oWebPart)).ListName;
    //else if (arr[i].StartsWith("Microsoft.SharePoint.WebPartPages."))
    //sControlName = arr[i].Length > 34 ? arr[i].Substring(34) : "";
    //else
    //sControlName = "";
    arr1[i] = Convert.ToString(oWebPart.ZoneIndex);
    Console.Write(arr[i] + " ");
    Console.WriteLine("Position" + arr1[i]);
    // ctx.ExecuteQuery();
    List announcementsList = context.Web.Lists.GetByTitle("Announcements");
    // This creates a CamlQuery that has a RowLimit of 100, and also specifies Scope="RecursiveAll"
    // so that it grabs all list items, regardless of the folder they are in.
    CamlQuery query = CamlQuery.CreateAllItemsQuery(1000);
    ListItemCollection items = announcementsList.GetItems(query);
    // Retrieve all items in the ListItemCollection from List.GetItems(Query).
    context.Load(items,
    itema => itema.Include(
    item => item,
    item => item["Title"],
    item => item["Expires"],
    item => item["Body"],
    item => item.FieldValuesAsText["Body"],
    item => item["Author"],
    item => item["Editor"]
    context.ExecuteQuery();
    foreach (ListItem listItem in items)
    // We have all the list item data. For example, Title.
    Console.WriteLine("Title" + listItem["Title"]+ " ");
    Console.WriteLine("Body" + listItem["Body"] != null ? Convert.ToString(listItem.FieldValuesAsText["Body"]) : string.Empty + " ");
    Console.WriteLine("Expires " + Convert.ToDateTime(listItem["Expires"] + " "));
    FieldUserValue oValue = listItem["Author"] as FieldUserValue;
    String strAuthorName = oValue.LookupValue;
    Console.WriteLine("Created at " + strAuthorName + " ");
    FieldUserValue oValue1 = listItem["Editor"] as FieldUserValue;
    String strAuthorName1 = oValue1.LookupValue;
    Console.WriteLine("Last Modified " + strAuthorName1);
    //Console.ReadKey();
    DataTable table = new DataTable();
    table.Columns.Add("Title");
    table.Columns.Add("Body");
    table.Columns.Add("Expires");
    table.Columns.Add("Author");
    table.Columns.Add("Editor");
    foreach (ListItem listItem in items)
    FieldUserValue oValue = listItem["Author"] as FieldUserValue;
    String strAuthorName = oValue.LookupValue;
    FieldUserValue oValue1 = listItem["Editor"] as FieldUserValue;
    String strAuthorName1 = oValue1.LookupValue;
    table.Rows.Add(listItem["Title"],listItem["Body"],Convert.ToDateTime(listItem["Expires"]),strAuthorName,strAuthorName1);
    //datagrid.DataSource = table;
    //ctx.ExecuteQuery();
    List EventsList = context.Web.Lists.GetByTitle("Event Calendar");
    // This creates a CamlQuery that has a RowLimit of 100, and also specifies Scope="RecursiveAll"
    // so that it grabs all list items, regardless of the folder they are in.
    CamlQuery queryEvent = CamlQuery.CreateAllItemsQuery(1000);
    ListItemCollection itemsEvent = EventsList.GetItems(queryEvent);
    // Retrieve all items in the ListItemCollection from List.GetItems(Query).
    context.Load(itemsEvent,
    itema => itema.Include(
    item => item,
    item => item["Title"],
    item => item["Location"],
    item => item["EventDate"],
    item => item["EndDate"],
    item => item["Description"],
    item => item.FieldValuesAsText["Description"],
    item => item["Event_x0020_Contact"],
    item => item["Event_x0020_Category"],
    item => item["Inhouse_x0020__x002f__x0020_Exte"],
    item => item["Expires_x0020_On"],
    item => item["Author"],
    item => item["Editor"]
    context.ExecuteQuery();
    foreach (ListItem listItemEvent in itemsEvent)
    // We have all the list item data. For example, Title.
    Console.WriteLine("Items of Events to be Printed");
    Console.WriteLine("Title: " + listItemEvent["Title"] + " ");
    Console.WriteLine("Title: " + listItemEvent["Location"] + " ");
    Console.WriteLine("Event Date: " + Convert.ToDateTime(listItemEvent["EventDate"] + " "));
    Console.WriteLine("End Date: " + Convert.ToDateTime(listItemEvent["EndDate"] + " "));
    string sDescription = listItemEvent["Description"] != null ? Convert.ToString(listItemEvent.FieldValuesAsText["Description"]) : "";
    Console.WriteLine("Description: " + sDescription);
    Console.WriteLine("Event Contact: " + listItemEvent["Event_x0020_Contact"] + " ");
    Console.WriteLine("Event Category: " + listItemEvent["Event_x0020_Category"] + " ");
    Console.WriteLine("Inhouse / External: " + listItemEvent["Inhouse_x0020__x002f__x0020_Exte"]);
    Console.WriteLine("Expires: " + Convert.ToDateTime(listItemEvent["Expires_x0020_On"]));
    FieldUserValue oAuthor = listItemEvent["Author"] as FieldUserValue;
    String sAuthor = oAuthor.LookupValue;
    Console.WriteLine("Author: " + sAuthor);
    FieldUserValue oEditor = listItemEvent["Editor"] as FieldUserValue;
    String sEditor = oEditor.LookupValue;
    Console.WriteLine("Editor: " + sEditor);
    //Console.ReadKey();
    DataTable tableEvents1 = new DataTable();
    tableEvents1.Columns.Add("Title");
    tableEvents1.Columns.Add("Location");
    tableEvents1.Columns.Add("EventDate");
    tableEvents1.Columns.Add("EndDate");
    tableEvents1.Columns.Add("Description");
    tableEvents1.Columns.Add("Event Category");
    tableEvents1.Columns.Add("Event Contact");
    tableEvents1.Columns.Add("Inhouse / External");
    tableEvents1.Columns.Add("Expires On");
    tableEvents1.Columns.Add("Author");
    tableEvents1.Columns.Add("Editor");
    foreach (ListItem listItemEvent in itemsEvent)
    FieldUserValue oValue = listItemEvent["Author"] as FieldUserValue;
    String strAuthorName = oValue.LookupValue;
    FieldUserValue oValue1 = listItemEvent["Editor"] as FieldUserValue;
    String strAuthorName1 = oValue1.LookupValue;
    tableEvents1.Rows.Add(listItemEvent["Title"]
    , listItemEvent["Location"]
    ,Convert.ToDateTime(listItemEvent["EventDate"])
    , Convert.ToDateTime(listItemEvent["EndDate"]), listItemEvent["Description"],
    listItemEvent["Event_x0020_Category"],listItemEvent["Event_x0020_Contact"],listItemEvent["Inhouse_x0020__x002f__x0020_Exte"]
    ,Convert.ToDateTime(listItemEvent["Expires_x0020_On"])
    ,strAuthorName,strAuthorName1);
    //datagrid.DataSource = table;
    // ctx.ExecuteQuery();

    Hi,
    Would you mind providing more details about why you want to perform the type conversion?
    According to your code, you might want to retrieve some properties of a web part in a page, please check that whether the built-in properties of
    Microsoft.SharePoint.Client.WebParts.WebPart can fulfill your requirement.
    WebPart members
    http://msdn.microsoft.com/en-us/library/microsoft.sharepoint.client.webparts.webpart_members(v=office.15).ASPX
    Feel free to reply if there are still any questions.
    Best regards
    Patrick Liang
    TechNet Community Support

  • SharePoint Server 2013 Upgrade failure after Updating SP1 + Nov10 CU " Exception of type 'Microsoft.SharePoint.Upgrade.SPUpgradeException' was thrown"

    After Successfully having SharePoint Server 2013 Farm Installation on 2 Servers AD + Central Admin Application server, OS: win server 2008 R2 Ent SP1.
    I set up the configuration for SharePoint app and Workflow Manager to work properly on the Den environment,  the time for SP1 running has come and after downloading the Service pack 1 of SharePoint server 2013 and completing the wizard, I run the SharePoint
    2013 Configuration Wizard after installing SharePoint 2013 SP1, and the wizard failed on step 2 with the Error from the Log file as showing below,
    "Task upgradebootstrap has failed with an unknown exception 
    01/04/2015 00:43:30  11  ERR                  Exception: Microsoft.SharePoint.Upgrade.SPUpgradeException: Exception of type 'Microsoft.SharePoint.Upgrade.SPUpgradeException' was thrown.
       at Microsoft.SharePoint.Upgrade.SPManager.BootStrap(Guid sessionId, SPUpgradeOperationFlags flags)
       at Microsoft.SharePoint.PostSetupConfiguration.UpgradeBootstrapTask.Run()
       at Microsoft.SharePoint.PostSetupConfiguration.TaskThread.ExecuteTask()"
    Also I was not able to create websites like before, and the creating of new site is failed with error message :
    "Failed to call GetTypes on assembly Microsoft.Office.TranslationServices, Version=15.0.0.0, Culture=neutral, PublicKeyToken=71e9bce111e9429c. Method not found: 'Microsoft.Office.Web.Common.ProcessImageInfo"
    Is there any solution to my problem with SP1 of SharePoint Server 2013, I don't think that SP1 should generate such bugs in a stable environment.
    Basel Badr ,SharePoint Specialist ,MCAD ,MCTS.

    Hi Basel,
    What edition of SharePoint do you have and what patch did you attempt to install?
    If you are on SharePoint 2013 Enterprise, please make sure you are installing Service Pack 1 for SharePoint Server:
    http://www.microsoft.com/en-us/download/details.aspx?id=42544
    If you are on SharePoint 2013 Foundation, please make sure you are installing  Service Pack 1 for SharePoint Foundation :
    http://www.microsoft.com/en-us/download/details.aspx?id=42548
    For more information, you can refer to the thread:
    https://social.technet.microsoft.com/Forums/sqlserver/en-US/ba9656e9-837e-4261-b164-b5bdfe8adce3/why-does-machine-translation-fail-when-i-do-not-use-it?forum=sharepointgeneral
    http://sharepoint.stackexchange.com/questions/84284/failed-to-call-gettypes-on-assembly-microsoft-office-translationservices
    Best Regards,
    Eric
    Eric Tao
    TechNet Community Support

  • SharePoint Online : Unable to load type Microsoft.SharePoint.Upgrade.SPUpgradeCompatibilityException required for deserialization.

    From today's morning , We are having Issue on Our Online SharePoint Site.
    Each WebPart is not loading and displaying this Line
    Unable to load type Microsoft.SharePoint.Upgrade.SPUpgradeCompatibilityException required for deserialization.
    Please write in quick response to fix it at
    [email protected]

    Hi,
    According to your post, my understanding is that SharePoint Online Site was unable to load web part and got the “Microsoft.SharePoint.Upgrade.SPUpgradeCompatibilityException” error.
    Per my knowledge, the SPUpgradeCompatibilityException occurs during upgrade when the front-end Web server attempts to connect to an incompatible database.
    Please check whether the database is compatible.
    Regarding SharePoint Online, for quick and accurate answers to your questions, it is recommended that you initial a new thread in Office 365 forum.
    Office 365 forum
    http://community.office365.com/en-us/forums/default.aspx
    Best Regards,
    Linda Li
    Linda Li
    TechNet Community Support

  • 'Uninstall app for SharePoint': Could not load type 'Microsoft.SharePoint.Administration.SPAppInstanceErrorDetails' from assembly 'Microsoft.SharePoint

    Hi there,
    I am new to developing with SharePoint and would like to create my first app for SP13 with VS12.
    To run SP13 and VS12 on the same virtual machine. The SP Tools Developer I have also installed.
    My problem:
    I select the Project Wizard from VS12 to create a new app SP13 using provider hosted option. After the project is created I want to directly deploy (F5), and yet I always get the following error:
    Error 1
    Error occurred in deployment step 'Uninstall app for SharePoint': Could not load type 'Microsoft.SharePoint.Administration.SPAppInstanceErrorDetails' from assembly 'Microsoft.SharePoint, Version=15.0.0.0, Culture=neutral, PublicKeyToken=71e9bce111e9429c'.
    0 0
    SharePointApp20132106
    Does anybody advice?

    Please have a look at the below thread
    http://social.msdn.microsoft.com/Forums/en-US/7b8a50ed-651d-4aa5-95f0-a551edb95550/sharepoint-hosted-app-deployment-error-in-sharepoint-2013-preview?forum=appsforsharepoint
    My Blog- http://www.sharepoint-journey.com|
    If a post answers your question, please click Mark As Answer on that post and Vote as Helpful

  • [COMException (0x80004005): Cannot complete this action Microsoft.SharePoint.Library.SPRequestInternalClass.GetFileAndMetaInfo

    i have sharepoint 2010 site which was running fine few days back. but now i am getting error. the funny thing is that i can't access the Homepage.aspx but if goto
    siteName//_layouts/viewlsts.aspx  i am able to see All list and library and can view any list item also.
    Cannot complete this action.
    Please try again.<nativehr>0x80004005</nativehr><nativestack></nativestack>
    Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code. 
    Exception Details: System.Runtime.InteropServices.COMException: Cannot complete this action.
    Please try again.<nativehr>0x80004005</nativehr><nativestack></nativestack>
    Source Error: 
    An unhandled exception was generated during the execution of the current web request. Information regarding the origin and location of the exception can be identified using the exception stack trace below.
    Stack Trace: 
    [COMException (0x80004005): Cannot complete this action.
    Please try again.<nativehr>0x80004005</nativehr><nativestack></nativestack>]
    Microsoft.SharePoint.Library.SPRequestInternalClass.GetFileAndMetaInfo(String bstrUrl, Byte bPageView, Byte bPageMode, Byte bGetBuildDependencySet, String bstrCurrentFolderUrl, Int32 iRequestVersion, Boolean& pbCanCustomizePages, Boolean& pbCanPersonalizeWebParts, Boolean& pbCanAddDeleteWebParts, Boolean& pbGhostedDocument, Boolean& pbDefaultToPersonal, Boolean& pbIsWebWelcomePage, String& pbstrSiteRoot, Guid& pgSiteId, UInt32& pdwVersion, String& pbstrTimeLastModified, String& pbstrContent, Byte& pVerGhostedSetupPath, UInt32& pdwPartCount, Object& pvarMetaData, Object& pvarMultipleMeetingDoclibRootFolders, String& pbstrRedirectUrl, Boolean& pbObjectIsList, Guid& pgListId, UInt32& pdwItemId, Int64& pllListFlags, Boolean& pbAccessDenied, Guid& pgDocid, Byte& piLevel, UInt64& ppermMask, Object& pvarBuildDependencySet, UInt32& pdwNumBuildDependencies, Object& pvarBuildDependencies, String& pbstrFolderUrl, String& pbstrContentTypeOrder) +0
    Microsoft.SharePoint.Library.SPRequest.GetFileAndMetaInfo(String bstrUrl, Byte bPageView, Byte bPageMode, Byte bGetBuildDependencySet, String bstrCurrentFolderUrl, Int32 iRequestVersion, Boolean& pbCanCustomizePages, Boolean& pbCanPersonalizeWebParts, Boolean& pbCanAddDeleteWebParts, Boolean& pbGhostedDocument, Boolean& pbDefaultToPersonal, Boolean& pbIsWebWelcomePage, String& pbstrSiteRoot, Guid& pgSiteId, UInt32& pdwVersion, String& pbstrTimeLastModified, String& pbstrContent, Byte& pVerGhostedSetupPath, UInt32& pdwPartCount, Object& pvarMetaData, Object& pvarMultipleMeetingDoclibRootFolders, String& pbstrRedirectUrl, Boolean& pbObjectIsList, Guid& pgListId, UInt32& pdwItemId, Int64& pllListFlags, Boolean& pbAccessDenied, Guid& pgDocid, Byte& piLevel, UInt64& ppermMask, Object& pvarBuildDependencySet, UInt32& pdwNumBuildDependencies, Object& pvarBuildDependencies, String& pbstrFolderUrl, String& pbstrContentTypeOrder) +589
    [SPException: Cannot complete this action.
    Please try again.]
    Microsoft.SharePoint.SPGlobal.HandleComException(COMException comEx) +27258082
    Microsoft.SharePoint.Library.SPRequest.GetFileAndMetaInfo(String bstrUrl, Byte bPageView, Byte bPageMode, Byte bGetBuildDependencySet, String bstrCurrentFolderUrl, Int32 iRequestVersion, Boolean& pbCanCustomizePages, Boolean& pbCanPersonalizeWebParts, Boolean& pbCanAddDeleteWebParts, Boolean& pbGhostedDocument, Boolean& pbDefaultToPersonal, Boolean& pbIsWebWelcomePage, String& pbstrSiteRoot, Guid& pgSiteId, UInt32& pdwVersion, String& pbstrTimeLastModified, String& pbstrContent, Byte& pVerGhostedSetupPath, UInt32& pdwPartCount, Object& pvarMetaData, Object& pvarMultipleMeetingDoclibRootFolders, String& pbstrRedirectUrl, Boolean& pbObjectIsList, Guid& pgListId, UInt32& pdwItemId, Int64& pllListFlags, Boolean& pbAccessDenied, Guid& pgDocid, Byte& piLevel, UInt64& ppermMask, Object& pvarBuildDependencySet, UInt32& pdwNumBuildDependencies, Object& pvarBuildDependencies, String& pbstrFolderUrl, String& pbstrContentTypeOrder) +27638207
    Microsoft.SharePoint.SPWeb.GetWebPartPageContent(Uri pageUrl, Int32 pageVersion, PageView requestedView, HttpContext context, Boolean forRender, Boolean includeHidden, Boolean mainFileRequest, Boolean fetchDependencyInformation, Boolean& ghostedPage, Byte& verGhostedPage, String& siteRoot, Guid& siteId, Int64& bytes, Guid& docId, UInt32& docVersion, String& timeLastModified, Byte& level, Object& buildDependencySetData, UInt32& dependencyCount, Object& buildDependencies, SPWebPartCollectionInitialState& initialState, Object& oMultipleMeetingDoclibRootFolders, String& redirectUrl, Boolean& ObjectIsList, Guid& listId) +1750
    Microsoft.SharePoint.ApplicationRuntime.SPRequestModuleData.FetchWebPartPageInformationForInit(HttpContext context, SPWeb spweb, Boolean mainFileRequest, String path, Boolean impersonate, Boolean& fGhostedPage, Byte& verGhostedPage, Guid& docId, UInt32& docVersion, String& timeLastModified, SPFileLevel& spLevel, String& masterPageUrl, String& customMasterPageUrl, String& webUrl, String& siteUrl, Guid& siteId, Object& buildDependencySetData, SPWebPartCollectionInitialState& initialState, String& siteRoot, String& redirectUrl, Object& oMultipleMeetingDoclibRootFolders, Boolean& objectIsList, Guid& listId, Int64& bytes) +26191185
    Microsoft.SharePoint.ApplicationRuntime.SPRequestModuleData.GetFileForRequest(HttpContext context, SPWeb web, Boolean exclusion, String virtualPath) +608
    Microsoft.SharePoint.ApplicationRuntime.SPRequestModule.InitContextWeb(HttpContext context, SPWeb web) +132
    Microsoft.SharePoint.WebControls.SPControl.SPWebEnsureSPControl(HttpContext context) +564
    Microsoft.SharePoint.ApplicationRuntime.SPRequestModule.GetContextWeb(HttpContext context) +27
    Microsoft.SharePoint.ApplicationRuntime.SPRequestModule.PostResolveRequestCacheHandler(Object oSender, EventArgs ea) +918
    System.Web.SyncEventExecutionStep.System.Web.HttpApplication.IExecutionStep.Execute() +80
    System.Web.HttpApplication.ExecuteStep(IExecutionStep step, Boolean& completedSynchronously) +171
    Thanks and Regards
    Er.Pradipta Nayak
    Visit my Blog
    Xchanging

    This could be due to a database health issue. If you run DBCC CHECKDB against this content database, does it come back with any consistency errors?
    Another option is to dismount and remount the database from SharePoint, using Dismount-SPContentDatabase and Mount-SPContentDatabase. Some consistency checks are performed during the mount operation.
    Trevor Seward
    Follow or contact me at...
    &nbsp&nbsp
    This post is my own opinion and does not necessarily reflect the opinion or view of Microsoft, its employees, or other MVPs.

  • Type 'Microsoft.SharePoint.WebControls.EmbeddedFormField' does not have a public property named 'div' - SharePoint 2013

    I was changing my Home page's Master Page, so I went to the advanced mode via SharePoint designer and changed the Master Page line, then that happened! I tried to export and Import the Home.aspx but same?!

    Hi,
    According to your post, my understanding is that you got errors when you changed the master page.
    Based on the earlier threads, If you forget the <zone template> tags, this issue may happen.
    You can wrap your whole code in a <div> tag, then check whether it works.
    There are some similar threads for your reference.
    http://mysharepointwork.blogspot.com/2011/07/type-microsoftsharepointwebcontrolsscri.html
    http://www.sharepointboris.net/2009/02/type-microsoftsharepointwebcontrolsformfield-does-not-have-a-public-property-named-xmlnssharepoint-error/
    http://social.technet.microsoft.com/Forums/en-US/89e99b85-5af3-45c1-a39e-677711329aba/error-systemwebuiwebcontrolscontentplaceholder-does-not-have-a-public-property-named?forum=sharepointadminprevious
    Thanks & Regards,
    Jason
    Jason Guo
    TechNet Community Support

  • My iMac with Mavericks update does not recognize my brother printer and I cannot even add the printer info in the system preferences printer list.  What is WRONG?

    I had to buy a new printer when I got my Imac and I chose the Brother multifunction inkjet MFCJ470DW.  It worked fine when my Mavericks version was 10.9.1, but after the automatic update to 10.9.2 the computer no longer recognizes the brother, or says it isn't connected, and when I deleted it from printer preferences and attempted to re-enter it as default printer, I cannot even type anything into the list of printers when I press the + sign to add.  What am I doing wrong?  Can someone please tell me even how to add text into the printer preferences list? 

    I had some of the same issues your having, deleted the printer from Printer and Scanner in System Preference.
    What I ended up doing was connecting the printer with a USB cable like it was a new set up, down loaded the drivers from Apple, still did not seem to work, but did a coupel of restarts and the printer was found then I completed the set up.

  • Calling a Web Service in a SSRS Report - Error Converting String to Generic List of Strings

    Hello,
    I am using SSRS version 2005 and am trying to call a web service to retrieve data for a SSRS report.  I've looked on Google and MSDN for the past 2 days and have exhausted all options.  Here are the details...
    The web service method I am calling accepts 4 parameters...
    Parameter 1 = Generic list of strings
    Parameter 2 = DateTime
    Parameter 3 = Int
    Parameter 4 = Int
    I have created a function (on the CODE tab in report properties) in my report that gets passed a comma delimited string and returns a Generic List of Strings that I use to format Parameter 1.  The code for the function is as follows:
    Public Function GetIDs(ByVal IDList as String) As List(Of String)
       Dim stringArray() = IDList.Split(",")
       Dim genericList As New List(Of String)(stringArray)
       Return genericList
    End Function
    I am passing a string to the function that looks something like this:
    "1,2,3,4"
    When I try to PREVIEW the report, I get an error that reads:
    "There is an error on line 0 of custom code: [BC30002] Type 'List' is not defined"
    I've tried changing the function declaration to pass back a string array:
    Public Function GetIDs(ByVal IDList as String) As String()
        Return IDList.Split(","c)
    End Function
    This returned the error (from the web service): 
    "Error in line 5 position 22.  Expecting state 'Element'.. Encountered 'Text' with name ", namespace"
    I have also tried changing the function declaration to pass back an array: 
    Public Function GetIDs(ByVal IDList as String) As ARRAY
    This also produced the error:
    "Error in line 5 position 22.  Expecting state 'Element'.. Encountered 'Text' with name ", namespace"
    I know that this particular web service method DOES work because it is coded to accept nulls in the first parameter.  So... when I call the method with nulls, it returns a recordset of ALL data (this works fine).  Only when I pass a string to the function (which "filters" the recordset by the ID list), does the error occur.
    Is SRSS limited with respect to VB.NET code so that the List(Of String) statement is not recognized?  Has anyone done this before and if so, how did you convert a comma delimited string to a Generic List of Strings within a function in the SSRS report?
    Any info would be greatly appreciated.
    Thanks!
    Bob

    Hi Bob,
    By default, in custom code, in order to use a variable or function that is not in the "System" namespace, we need to provide the full name.
    In this case, the full name of the "List" is "System.Collections.Generic.List"
    So, to solve the issue, please use the following code:
    Public Function GetIDs(ByVal IDList as String) As System.Collections.Generic.List(Of String)
    Dim stringArray() = IDList.Split(",")
    Dim genericList As New System.Collections.Generic.List(Of String)(stringArray)
    Return genericList
    End Function
    If you have any more questions, please feel free to ask.
    Thanks,
    Jin Chen
    Jin Chen - MSFT

  • Fax printer drivers cannot work well through Microsoft SDK

    When using Fax printer drivers and Microsoft SDK to print a txt file in WIN7 or WIN SERVER 2008 R2, open the generated tif file with windows photo Viewer, it shows error "Windows photo viewer can't open this picture because the file appears to be damaged,
    corrupted, or is too large". We notice that, just more than two pages the issue can be reproduced.
    And then we reproduce the issue in WIN8 with the same code, it works well.
    So we think Fax driver may be has bug in WIN7 and WIN SERVER 2008 R2.
    Here is the code:
    using System;
    using System.Collections.Generic;
    using System.ComponentModel;
    using System.Data;
    using System.Drawing;
    using System.Drawing.Printing;
    using System.IO;
    using System.Text;
    using System.Windows.Forms;
    using System.Linq;
    namespace FaxPrinter
        public partial class Form1 : Form
            private Button printButton;
            private PrintDocument printDocument1 = new PrintDocument();
            private string stringToPrint;
            public Form1()
                InitializeComponent();
                this.printButton = new System.Windows.Forms.Button();
                this.printButton.Location = new System.Drawing.Point(12, 51);
                this.printButton.Size = new System.Drawing.Size(75, 23);
                this.printButton.Text = "Print";
                this.printButton.Click += new System.EventHandler(this.printButton_Click);
                this.ClientSize = new System.Drawing.Size(292, 266);
                this.Controls.Add(this.printButton);
                // Associate the PrintPage event handler with the PrintPage event.
                printDocument1.PrintPage +=
                    new PrintPageEventHandler(printDocument1_PrintPage);
            private void button1_Click(object sender, EventArgs e)
                ReadFile();
                printDocument1.Print();
            private void ReadFile()
                string docName = "1.txt";
                string docPath = "C:\\reports\\";
                printDocument1.DocumentName = docName;
                using (FileStream stream = new FileStream(docPath + docName, FileMode.Open))
                using (StreamReader reader = new StreamReader(stream))
                    stringToPrint = reader.ReadToEnd();
            private void printDocument1_PrintPage(object sender, PrintPageEventArgs e)
                int charactersOnPage = 0;
                int linesPerPage = 0;
                // Sets the value of charactersOnPage to the number of characters 
                // of stringToPrint that will fit within the bounds of the page.
                e.Graphics.MeasureString(stringToPrint, this.Font,
                    e.MarginBounds.Size, StringFormat.GenericTypographic,
                    out charactersOnPage, out linesPerPage);
                // Draws the string within the bounds of the page
                e.Graphics.DrawString(stringToPrint, this.Font, Brushes.Black,
                    e.MarginBounds, StringFormat.GenericTypographic);
                // Remove the portion of the string that has been printed.
                stringToPrint = stringToPrint.Substring(charactersOnPage);
                // Check to see if more pages are to be printed.
                e.HasMorePages = (stringToPrint.Length > 0);
            private void printButton_Click(object sender, EventArgs e)
                ReadFile();
                printDocument1.Print();

    Hello Petter,
    From your description, it should be that you code is ok since it works on win8, and the underlying driver the PrintDocument class called could be the caused reason due to different windows operation system. For this, I move it to the driver related
    forum, since this forum is for .NET class libraires.
    Regards.
    We are trying to better understand customer views on social support experience, so your participation in this interview project would be greatly appreciated if you have time. Thanks for helping make community forums a great place.
    Click
    HERE to participate the survey.

  • SharePoint OOB Item level Permission under List Settings

    Users & Roles:
    Authors: User with author role can create a new item but can only edit/delete their own items and not other user items. They should not modify or view the list settings(Permission level - Contribute)
    Editor: User with Editor role can create a new item and can Edit/Delete their own items and also other user items. They should not modify or view the list settings(Permission level - Contribute)
    1. Created a new list.
    2. In advance setting enabled "Item-level
    Permissions" as follows,
    For Read
    Accesss selected "Read all items"
    For Create
    and Edit access selected "Create items and edit items that were created by the user"
    Now, User with Editor access can't able to Edit/delete other user items but can able to Edit/Delete their own items(same as user with Author role).
    Then i have changed the Editor access Permission level to
    Edit. In Edit Permission level  i have enabled Override Check-Out
    and disabled Manage Lists. But still user with Editor access doesn't satisfy the condition.
    kindly help me on this to resolve the above issue.
    For Read
    Accesss select "Read items that were created by the user"
    For Create
    and Edit access select "Create items and edit items that were created by the user"
    For Read
    Accesss select "Read items that were created by the user"
    For Create
    and Edit access select "Create items and edit items that were created by the user"
    For Read
    Accesss select "Read items that were created by the user"
    For Create
    and Edit access select "Create items and edit items that were created by the user"

    Hi Nishok,
    Agree with Paul's opinion, you can create an event receiver to set Item Level Permission. Here is the snippet:
    using System;
    using System.Diagnostics;
    using System.Threading;
    using System.Windows.Forms;
    using System.Security.Permissions;
    using Microsoft.SharePoint;
    using Microsoft.SharePoint.Utilities;
    using Microsoft.SharePoint.Workflow;
    namespace ItemLevelSecurity.ItemSecurity
    /// <summary>
    /// List Item Events
    /// </summary>
    public class ItemSecurity : SPItemEventReceiver
    /// <summary>
    /// An item was added.
    /// </summary>
    public override void ItemAdded(SPItemEventProperties properties)
    SPSecurity.RunWithElevatedPrivileges(delegate()
    try
    using (SPSite oSPSite = new SPSite(properties.SiteId))
    using (SPWeb oSPWeb = oSPSite.OpenWeb(properties.RelativeWebUrl))
    //get the list item that was created
    SPListItem item = properties.ListItem;
    //get the author user who created the item
    SPFieldUserValue valAuthor = new SPFieldUserValue(properties.Web, item["Created By"].ToString());
    SPUser oAuthor = valAuthor.User;
    //assign permissions to task author
    AssignPermissionsToItem(item,oAuthor,SPRoleType.Reader);
    //update the item
    item.Update();
    base.ItemAdded(properties);
    catch (Exception ex)
    properties.Status = SPEventReceiverStatus.CancelWithError;
    properties.ErrorMessage = ex.Message;
    properties.Cancel = true;
    public static void AssignPermissionsToItem(SPListItem item, SPPrincipal obj, SPRoleType roleType)
    if (!item.HasUniqueRoleAssignments)
    item.BreakRoleInheritance(false, true);
    SPRoleAssignment roleAssignment = new SPRoleAssignment(obj);
    SPRoleDefinition roleDefinition = item.Web.RoleDefinitions.GetByType(roleType);
    roleAssignment.RoleDefinitionBindings.Add(roleDefinition);
    item.RoleAssignments.Add(roleAssignment);
    Best Regards,
    Eric
    Eric Tao
    TechNet Community Support

Maybe you are looking for

  • How to send jpegs in a text message

    Is it possible to send jpegs in a text message?

  • T410 DVD Drive Problem

    My T410 is annoying the hell out of me! My DVD drive keeps turning on and off, every 30 second or so. The following message keeps coming up: 'The HL-DT-SD-DVDRAM-GU10N device can now be savely removed from the computer' as this happens, the DVD drive

  • 10g Upgrade Order (DEV - QAS - PRD)

    If I am upgrading Oracle 9.2.0.6 to 10.2.0.2, what issues will I face if I upgrade the landscape in the order of DEV, QAS, PRD. I will wait a week between upgrades. Will transports fail? Will SAP face any issues having different Oracle versions? Do I

  • Do i have to be concerned with TRIM with a 3rd party SSD

    Im looking into getting a 3rd party SSD for my late 2008 aluminum unibody macbook i am under the impression that TRIM is off by default, Do i need to turn it on? will it mess up my mac running Yosemite? can i simply ignore the word TRIM all together

  • Registrierung von CS6

    Ich habe eine Lehrerversion von CS6 gekauft und sie wurde von Adobe unter Zuteilung einer gültigen Seriennummer freigeschaltet. Beim Lizensieren erhalte ich aber immer die Meldung: "Diese Seriennummer ist für dieses Produkt nicht gültig". Beim Regist