4
XDocument fldSchema = XDocument.Parse(fldLookup.SchemaXml);
XElement Root = fldSchema.Root;
if (Root.Attribute("List") != null)
{

    if (SourceList != null)
    {
        XAttribute objList = Root.Attribute("List");
        objList.Value = SourceList.ID.ToString();

        XAttribute objSourceID = Root.Attribute("SourceID");
        objSourceID.Value = SourceList.ID.ToString();

        //XAttribute objWebID = Root.Attribute("WebId");
        //objWebID.Value = OWeb.ID.ToString();

        fldLookup.SchemaXml = fldSchema.ToString();
        OWeb.AllowUnsafeUpdates = true;
        fldLookup.Update(true);
        OWeb.AllowUnsafeUpdates = false;
    }
}

I have developed sandbox solution in visual studio.

WSP is working fine in on prem SharePoint . But when I am uploading WSP in SharePoint online and create new web site using my web template which is part of the WSP it gives me error.

Question:

  1. Is system.xml.linq dll working on SharePoint online?
  2. Is System.Linq dll Working on SharePoint online?

Error:

"Unhandled exception was thrown by the sandboxed code wrapper's Execute method in the partial trust app domain: An unexpected error has occurred"

Note: WSP is working fine on On prem Server but it's not working SharePoint online when it's going to create list instance using ONET.XML.

0

If your solution have UI than Please try to put label in it. Place your code in TRY CATCH as shown below & write your error message in lable

E.G.

in .ASPX

<label id="lblErrormsg" runst="server"></label>

in your code behind

try
{
**Your code here.......**
XDocument fldSchema = XDocument.Parse(fldLookup.SchemaXml);
XElement Root = fldSchema.Root;
if (Root.Attribute("List") != null)
{

    if (SourceList != null)
    {
        XAttribute objList = Root.Attribute("List");
        objList.Value = SourceList.ID.ToString();

        XAttribute objSourceID = Root.Attribute("SourceID");
        objSourceID.Value = SourceList.ID.ToString();

        //XAttribute objWebID = Root.Attribute("WebId");
        //objWebID.Value = OWeb.ID.ToString();

        fldLookup.SchemaXml = fldSchema.ToString();
        OWeb.AllowUnsafeUpdates = true;
        fldLookup.Update(true);
        OWeb.AllowUnsafeUpdates = false;
    }
}
}
catch(Exception ex)
{
lblErrormsg.Text = ex.Message;
}

I am here just trying to get you to the original exception.

If you still have a problem than please provide me more information what do you want to achieve in your code.

  • 1
    I have already put the Try catch in the code. but we are not able to debug the code in share point online . And that's the limitations of the SharePoint online . and i have code on feature receiver of list instance feature. so i can't get aspx page to get actual error out sides. – Dipen Shah Dec 22 '15 at 8:00
  • 1
    you can launch the debugger via code in your feature receiver. Simply, add the following code to get started. System.Diagnostics.Debugger.Launch(); When you activate the feature, a Visual Studio dialog will pop up asking you where you want to debug your process, just choose the Visual Studio project that contains your source code (assuming you already have Visual Studio open with that project). This is also the technique I use when I need to debug custom stsadm commands. Once you are done debugging, you will of course want to remove the line launching the debugger. – Hardik Dec 22 '15 at 8:08
  • 1
    Technique is not working on share point online. If i deploy code in my server , i can debug the whole code. but after download the WSP file from the solution , and upload it to share point online site. i m not able to debug the code on feature activation. – Dipen Shah Dec 22 '15 at 8:45

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.