Sharepoint 2010 lookup field ID format - visual-studio-2010

I'm new to Sharepoint 2010 and I'm currently trying to create lookup field, add it to content type and add it to the list via Visual Studio 2010 SharePoint project. But I experience some weird problem.
I've defined a lookup field in the following way:
<Field ID="{2A5567B7-1175-4E26-A4ED-382E4744D17A}" Type="Lookup" Name="SomeLookupField" List="Lists/SomeList" ShowField="ItemName" DisplayName="Some Field" Group="Custom Group" ReadOnly="TRUE" />
Then I added it to ContentType via FieldRef element. And, finally, List Definition contains the same element in Schema.xml
It works fine until I'm trying to save my site as template. Sharepoint fails to export the site and displays error:
Microsoft.SharePoint.SPException: Error exporting the site field named "SomeLookupField". at Microsoft.SharePoint.SPSolutionExporter.ExportFields(SPFieldCollection fields, String partitionName)
That is caused by the error:
SPSolutionExporter: System.FormatException: Guid should contain 32 digits with 4 dashes (xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx). at System.Guid..ctor(String g) at Microsoft.SharePoint.SPSolutionExporter.GetFieldSchemaXml(SPField field, SPWeb web, Boolean isFieldFromWeb, Boolean removeSealedAttribute) at Microsoft.SharePoint.SPSolutionExporter.ExportField(SPField field, SPWeb web)
Playing around I found out that lookup field ID should not contain curly brackets and be like the following:
<Field ID="2A5567B7-1175-4E26-A4ED-382E4744D17A"
After I changed it export start working fine. But redeploy from Visual Studio is broken now as it doesn't delete the field while removing old feature and fails on updated feature activation with the error:
Error occurred in deployment step 'Activate Features': The field with Id {2A5567B7-1175-4E26-A4ED-382E4744D17A} defined in feature {235313d2-4091-4655-8b35-70b3ad31b9f4} was found in the current site collection or in a subsite.
I wonder what can be wrong with my lookup field definition? What is a valid format of defining lookup fields?

Found the solution. Lookup column definition must have overwrite attribute set to 'TRUE'. Blogged about it here

Related

How to retrieve addresses using the odata endpoint

I'm trying to retrieve an address on a standard entity.
the request is the following :
https://mycrm.api.crm4.dynamics.com/api/data/v9.1/contacts(guid)
In this example, I get all fields, but the ones that is of interest to me is address1_addressid, which seems to be a Guid, referencing some of record, but I cannot find it in the "Many to One" relationship list I retrieved using the following command :
https://mycrm.api.crm4.dynamics.com/api/data/v9.1/EntityDefinitions(LogicalName='contact')?$select=LogicalName&$expand=ManyToOneRelationships($select=ReferencingAttribute,ReferencedEntity)
I would like to retrieve those addresses in a generic manner, as I'm working on a generic NetStandard 2.0 library. I won't be able to know on which entity I'll be working, and thus won't be able to hard-code a list of addresses field names.
Here's one way to find the Contact to Address relationship:
https://myOrg.api.crm.dynamics.com/api/data/v9.1/EntityDefinitions(LogicalName='customeraddress')?$select=LogicalName&$expand=ManyToOneRelationships($select=ReferencingAttribute,ReferencedEntity)
I got an error with https://myOrg.api.crm.dynamics.com/api/data/v9.1/contacts(guid)?$expand=address1_addressid.
I looked into the MetaData and discovered that address1_addressid has a type of Primary Key:
While a normal lookup field has a type of Lookup:
Considering the error message that appears when attempting to expand address1_addressid, I think the issue is address1_addressid's data type.
Property 'address1_addressid' on type 'Microsoft.Dynamics.CRM.contact'
is not a navigation property or complex property. Only navigation
properties can be expanded.
It would seem that rather than using $expand to get the address details, you'd have to make a separate call for it:
https://myOrg.api.crm.dynamics.com/api/data/v9.1/customeraddresses(guid)
UPDATE
By reviewing the full Contact-Address relationship, via this query: https://myOrg.api.crm.dynamics.com/api/data/v9.1/EntityDefinitions(LogicalName='customeraddress')?$select=LogicalName&$expand=ManyToOneRelationships.
I discovered the ReferencedEntityNavigationPropertyName was set to Contact_CustomerAddress.
The error message before talked about the Navigation property so I gave it a shot. Using that property named allowed me to expand the Address info from the Contact:
https://myOrg.api.crm.dynamics.com/api/data/v9.1/contacts(guid)?$expand=Contact_CustomerAddress
Interestingly, expanding that navigation property returns all 3 customer addresses:

SharePoint Business Connectiviy Data Model Update method failing

I have an external list in SharePoint that references a BCDM I created inside visual studio. The entity as an ID that is auto generated in the database, which means it's read-only.
Create and read method works fine, I'm trying to implement the update method. I have set an input parameter that match my entity and I'm getting this error.
Failed to update a list item for this external list based on the Entity(External Content Type) ‘Notification’ in EntityNamespace ‘Namespace’. Details: The TypeDescriptor with name ‘Id’ in the Method ‘Microsoft.SharePoint.BusinessData.MetadataModel.Static.Method’ on Entity (External Content Type) with Name ‘Namespace’ in Namespace ‘Notification’ is marked ‘PreUpdaterField’, but is contained by another TypeDescriptor marked ‘PreUpdaterField’.
I tried every possible combinaison to make this work, make the id type descriptor read only, pre-updater field = true/ false/, updater field = true/false, removing it, adding another parameter outside the entity. NOTHING WORKS !!! Obviously, I'm about to commit a murder as something so simple just turned out to be the biggest waste of time in my programmation history. What can I do to make this works??
This has been resolved and is explained here:
http://www.dotnetmikael.com/2014/02/sharepoint-2013-bcdm-with-visual-studio.html

Drupal 7 Views Multiple Contextual Filters

I'm running Drupal 7 with Organic Groups. I cloned the "OG all user group content" view added an Entity Reference to it to be used as a field in one of my content types. My question is:
How can I use an additional contextual filter (Content Type) so that I can add an Argument to the Entity Reference field?
Entering the content type name isn't working: 1/article for example.
So I got the answer from:
https://drupal.stackexchange.com/questions/53861/how-to-show-nodes-of-a-content-type-using-contextual-filters-as-filters
Adding "Content Type" contextually typically requires a Node ID however; using PHP Code you can simply add:
return TRUE;
and this will allow you to enter the content type name (the physical name; i.e. OpenLayers Location field is named Location but the physical path is ol_locator_location).
When you edit the view in the Advanced link, you can see "Contextual Filter"; there you can add the field you added to the content type.

Unable to display web part error on Custom List Form (New Item)

I'm gonna take my chance at asking a question here because I really cannot find the root cause of this problem.
I'm working on a WSS 3.0 site, using SPD 2007 and I'm fairly new to Sharepoint development in general.
I'm customizing the DispForm.aspx page. The page is a simple edit page but at the end, I add a custom list form web part for adding comments (which are stored in another list) and below, a dataview for viewing the comments associated to the item displayed by the DispForm.aspx page.
What i want to do resembles the functionality displayed on this page, I inspired myself from it and you can in fact see my comments as the latest one :
http://sharepoint.microsoft.com/blogs/GetThePoint/Lists/Posts/Post.aspx?ID=209
Everything was working, until I delete all the comments i had made as a test. Now all i get from my Custom List Form is this "unable to display this web part error".
I've had a look at the logs, I understand what it is complaining about but i have no clue on how to fix it or even understand why there is such an error to begin with.
SPDataSourceView.ExecuteSelect() - selectArguments: IsEmpty=True, MaximumRows=0, RetrieveTotalRowCount=False, SortExpression=, StartRowIndex=0, TotalRowCount=-1
Error while executing web part: System.InvalidOperationException: Unable to open the specified list item. --->
System.ArgumentException: **Value does not fall within the expected range**.
at Microsoft.SharePoint.SPList.**GetItemById**(Int32 id, String strRootFolder, Boolean cacheRowsetAndId)
at Microsoft.SharePoint.SPList.GetItemById(Int32 id)
at Microsoft.SharePoint.WebControls.SPDataSourceView.ExecuteSelect(DataSourceSelectArguments selectArguments) --- End of inner exception stack trace ---
at Microsoft.SharePoint.WebControls.SPDataSourceView.ExecuteSelect(DataSourceSelectArguments selectArguments)
at System.Web.UI.DataSourceView.Select(DataSourceSelectArguments arguments, DataSourceViewSelectCallback callback)
at Microsoft.SharePoint.WebControls.SingleDataSource.GetXPathNavigatorInternal()
at Microsoft.SharePoint.WebControls.SingleDataSource.GetXPathNavigator()
at Microsoft.SharePoint.WebControls.SingleDataSource.GetXPathNavigator(IDataSource datasource, Boolean originalData)
at Microsoft.SharePoint.WebPartPages.DataFormWebPart.GetXPathNavigator(String viewPath)
at Microsoft.SharePoint.WebPartPages.DataFormWebPart.PrepareAndPerformTransform()
InnerException 1: System.ArgumentException: Value does not fall within the expected range.
at Microsoft.SharePoint.SPList.GetItemById(Int32 id, String strRootFolder, Boolean cacheRowsetAndId)
at Microsoft.SharePoint.SPList.GetItemById(Int32 id)
at Microsoft.SharePoint.WebControls.SPDataSourceView.ExecuteSelect(DataSourceSelectArguments selectArguments)
we're talking about a "new item" form, so i don't understand why I'm getting an error on GetItemById. What is it trying to get and how do i fix it?
Finally, I haven't changed the CAML query created by SPD. I did make change to the Comments list such as renaming or deleting unused columns but i don't think it is the cause of the problem because deleting the custom list form and recreating it didn't fix the issue.
Any clues as to where or what I should be looking at? I'm fresh out of ideas.
Thanks.
In Sharepoint Designer, Open the DispForm that you inserted the "Comments" custom list form into.
In Code view, find the DataFormWebPart for the list.
Locate the line <SharePoint:SPDataSource runat="server" DataSourceMode="ListItem" and change the DataSourceMode to DataSourceMode="List"
Inside of the ParameterBindings, find <ParameterBinding Name="ListItemId"..... and change it to <ParameterBinding Name="ListItemId" Location="None" DefaultValue="0"/>

JBO-25002: What is the reason for this error?

I was running my project and was checking recently modified module. On click of the Menu tab it was giving me "java.lang.UnsupportedOperationException" and when I checked in the log I could find the following description:
JBO-25002: Definition com.project.view.pageDefs.pages_per_SearchPageDef
of type Form Binding Definition not found
oracle.jbo.NoDefException: JBO-25002: Definition com.project.view.pageDefs.pages_per_SearchPageDef
of type Form Binding Definition not found
What could be the problem?
You say you were checking "recently modified module". What modification did you make? Was it something which invalidated the business component definition? The documentation says this about JBO-25002:
"Provide a correct name for the business component definition. If the
definition is not in the classpath, you must include it there. Names
are of the format
myProjectPackage.BusinessPackage.BusinessComponent. This error can
also occur if there is a case conflict, as when the database expects
"DEPTNO" and receives "Deptno" instead."
I got this error after changing a query in my View Object. The change removed 3 columns but in the PageDef file the tree binding retained the old column names. I manually removed those column names to fix the problem.

Resources