Sharepoint List added to Create -> Custom Lists on Feature deployment - visual-studio

I am building a SharePoint Feature to deploy a simple WebPart and a custom list within the "Web" scope.
When the solution is deployed my list is immediately available in Site Actions -> Site Settings -> Custom Lists.
If you try and create an instance of the list I receive "File Not Found"
If you activate the feature a second copy of the list template is added to the Custom Lists heading.
Neither list can be created with the same "File Not Found" error
On deactivating the feature one list template disappears
On retracting the solution the last list template disappears
Files Involved:
schema.xml is 5000 lines long
feature.xml is as follows
<?xml version="1.0" encoding="utf-8" ?>
<Feature Id="78a8eaad-2160-434c-81c2-6c5f7ce94ade" Title="WeekWidget" Description="Displays A, B or H based upon a configurable SharePoint List." Version="1.0.0.0" Creator="Cardinal Newman Catholic School // Richard Slater" Scope="Web" ImageUrl="WeekWidget\WeekWidgetLogo.jpg" xmlns="http://schemas.microsoft.com/sharepoint/" DefaultResourceFile="core">
<ElementManifests>
<ElementManifest Location="ListTemplates\WeekCalendar.xml" />
<ElementFile Location="WeekCalendar\Schema.xml" />
</ElementManifests>
</Feature>
WeekCalendar.xml is as follows
<?xml version="1.0" encoding="utf-8" ?>
<Elements xmlns="http://schemas.microsoft.com/sharepoint/">
<ListTemplate Name="WeekCalendar" DisplayName="Week Calendar" Description="List of Weeks." BaseType="0" Type="100" OnQuickLaunch="TRUE" SecurityBits="11" Sequence="410" Image="/_layouts/images/itgen.gif" />
</Elements>
I think the "File Not Found" error is symptomatic of another problem, however the addition of the list template shouldn't happen on solution deployment. What am I doing wrong?

are you wiring up all of the feature files yourself or using a tool? typically, the 404 means one of the 'magic strings' in your configuration files is off. Also, the directory structure specified here looks suspicious:
<ElementManifests>
<ElementManifest Location="ListTemplates\WeekCalendar.xml" />
<ElementFile Location="WeekCalendar\Schema.xml" />
</ElementManifests>
You should try deploying all of your feature support files to the same directory. Have you located the error in the ULS log (<12 hive>/LOGS)? That may provide some clues too.

I think the problem could be related to the separate directory structure--I usually deploy all list files to the same folder (schema.xml and weekcalendar.xml, in your case; keep feature.xml out of the list directory).
Turn on verbose logging and check the 12-hive logs to see what file is not found.
Check schema.xml and ensure the name attribute on the list element matches the name of the folder housing your feature. Also watch out for the Url attribute on this element... VSeWSS will set the URL to the name of the list being reverse engineered so I change it to "pages\viewpage.axp".
On the default view element within schema.xml, try adding SetupPath="pages\viewpage.aspx". Ensure there's a WebPartZoneId="Main" attribute on there as well.

Related

Extending Visual Studio 2017 XML editor

I'm trying to improve our workflow with some XML-configuration files we use in a Visual Studio Solution. I figured I'll start with explaining what I'm trying to accomplish and then explain some of my ideas that I've tried for several hours without success.
The Problem
I'm working with a system where the data model is configured in a database, the models are also stored on disk using xml-files, these are then synced during startup of the app. Here's part of the stuff that are synced:
Data Types
All data types lives in one XML configuration file per data type and each has some properties like Name and Key. All data types are configured in the same folder, example: /config/dataTypes
Example
textString.config
<?xml version="1.0" encoding="UTF-8" ?>
<DataType Key="a45c9a94-09d7-4df9-85e6-d6930abc6c12" Name="Textstring">
textArea.config
<?xml version="1.0" encoding="UTF-8" ?>
<DataType Key="b104788f-4e2f-4592-9387-8b3861bd8046" Name="Textarea">
Entity Types
Think of these as models with X number of properties, each property is configured and connected to a Data Type.
Example
customer.config
<?xml version="1.0" encoding="UTF-8" ?>
<Entity>
<Properties>
<Property Name="Firstname" TypeKey="a45c9a94-09d7-4df9-85e6-d6930abc6c12" />
<Property Name="Lastname" TypeKey="a45c9a94-09d7-4df9-85e6-d6930abc6c12" />
<Property Name="Description" TypeKey="b104788f-4e2f-4592-9387-8b3861bd8046" />
</Properties>
</Entity>
My end goal is to provide intellisense when editing a Entity Type so that I'll get all the Data Types as suggestions when entering the "TypeKey" property of the Property element. Preferably showing the Name of the data type in the dropdown list and when choosing it adding the guid as value for the TypeKey-property. I would also like to show the Data Types name when hovering the GUID with the mouse (or in some other way).
As you can imagen during the process with a project new data types can be added so the intellisense needs to be dynamic based on the files in the data types-folder.
I should also mention that these configuration files also can be edited from a UI in the application and I don't have control over how they are serialized, hence - there is no XML namespace in the files, they look like in the examples above.
We also have multiple different VS-solutions with different setups of Data Types and Entity Types. So we need individual intellisense in each project.
What I've tried
My first idea was to create a VS-extension that creates a dynamic XML Schema XSD-file based on the files in the data types folder. The VS would then pick up and use the XSD for XML-files in the Project, turns out that this only works with a namespace configured (remember, I can't add namespaces since I don't control the external app).
To get around this it worked to manually add the schema-file to the XML file while editing the file. (Like this: https://learn.microsoft.com/en-us/visualstudio/xml-tools/how-to-select-the-xml-schemas-to-use?view=vs-2019). The problem with this is that it needs to be done for each xml-file and the setting is not stored.
I then started to play with the VS extension possibilities to try to automatically configure this Schema to a XML-file that is opened. Turns out I had a really hard time to get the "configuration object" that is pushed to the Properties Browser when the XML file is opened. I managed to get a event-handler setup that was triggered when the XML files as getting "focus" but I was stucked trying getting the properties from the Properties Browser.
I also tried another approach with a custom "code completion"-extension but it made the UI feel very "cluttered" while editing.
After spending about 10 hours playing around with this I feel I don't really have a good path to a solution as my experience with VS-extensions is not that extensive.
I would love to get some feedback and ideas on how to approach this problem, since the XSD is different from each project if I go down the "dynamic" path we can't use the global VS settings since each project has different data types hence needs different allowed values for the TypeKey property.
One approach that I'm thinking about is to use a generic XSD (allowing all values for the TypeKey) in the Global Schema Cache for Visual Studio and create a "code completion"-feature for just the TypeKeys.
Any thoughts and pointers in the right direction would be very much appreciated.

IBM SBT: Updating a subcommunity breaks subcommunity relation?

I have implemented creation of subcommunities using IBM SBT 1.0.2.20140527-1807 against IC 4.5 (thanks for heavy API changes from 1.0.1 :-/ ) and want to update a freshly created subcommunity with a nice "content" containing some HTML with links to some content inside this community. Thus I must first create the subcommunity and afterwards update the "content" attribute, because I need some data not yet present before successful creation.
The way I do this is basically as follows:
(1) Create subcommunity [proven successful, and it IS a subcommunity now]
(2) Fetch the new subcommunity using CommunityService.getCommunity(communityUuid) [proven successful]
(3) execute community.setContent(string) [no errors]
(4) execute CommunityService.updateCommunity(community) [no errors]
The REST request created and sent for CREATE is:
POST /communities/service/atom/community/subcommunities?communityUuid=8ea4ff45-ef58-4c9b-b131-def2d3e233f7
The XML data sent is:
<?xml version="1.0" encoding="UTF-8"?>
<entry xmlns="http://www.w3.org/2005/Atom" xmlns:app="http://www.w3.org/2007/app" xmlns:snx="http://www.ibm.com/xmlns/prod/sn">
<title type="text">mytitle</title>
<content type="html">mycontent</content>
<category term="community" scheme="http://www.ibm.com/xmlns/prod/sn/type"></category>
<category term="mytag"></category>
<snx:communityType xmlns:snx="http://www.ibm.com/xmlns/prod/sn">private</snx:communityType>
</entry>
The REST request created and sent for UPDATE is:
PUT /communities/service/atom/community/instance?communityUuid=ae63bedf-98f2-45d4-ad6a-4dfd1f3a58d7
The XML data sent is:
<?xml version="1.0" encoding="UTF-8"?>
<entry xmlns="http://www.w3.org/2005/Atom" xmlns:app="http://www.w3.org/2007/app" xmlns:snx="http://www.ibm.com/xmlns/prod/sn">
<title type="text">mytitle</title>
<content type="html">mycontent</content>
<category term="community" scheme="http://www.ibm.com/xmlns/prod/sn/type"></category>
<category term="mytag"></category>
<snx:communityType xmlns:snx="http://www.ibm.com/xmlns/prod/sn">private</snx:communityType>
<snx:communityUuid xmlns:snx="http://www.ibm.com/xmlns/prod/sn">ae63bedf-98f2-45d4-ad6a-4dfd1f3a58d7</snx:communityUuid>
<id>http://communities.ibm.com:2006/service/atom/community/instance?communityUuid=ae63bedf-98f2-45d4-ad6a-4dfd1f3a58d7</id>
</entry>
Afterwards the content is indeed updated -- but the community is not a subcommunity any more, but a regular top level community.
Why is that?
What can I do about it?
For the impatient: I have found the root cause, and in some circumstances this offers the possibility for a workaround.
The root cause is that the Community representation in IBM SBT SDK (Java) currently (as of July 2014) does not offer a "parent community URL" element.
http://www-10.lotus.com/ldd/appdevwiki.nsf/xpDocViewer.xsp?lookupName=IBM+Connections+4.5+API+Documentation#action=openDocument&res_title=Community_entry_content_ic45&content=pdcontent says that a community XML representation has a <link rel="http://www.ibm.com/xmlns/prod/sn/parentcommunity" type="application/atom+xml" href="..." /> element (where href is the atom/instance URL, not the "community URL" with html/communityview) if it represents a subcommunity, which is ignored on PUT/POST -- but:
THIS IS NOT TRUE:
In fact this element is REQUIRED on PUT to keep a community's "sub community" nature on change. And worse: If it is broken, it cannot be "repaired": Because of other limitations for subcommunities, an existing community cannot be changed to become a subcommunity of another top level community. Subcommunities can only be CREATED (and kept, of course).
What I have done to work around that pitfall is to subclass Community and some other classes to extend the XML marshal/unmarshal mechanisms in SBT SDK to cope with parent community URLs. If you know what you're doing everything is fine, but if you want generic code which simply does not break subcommunities, you must also READ ALL COMMUNITIES as if they may be subcommunities. If you don't, you won't see this information and write back the community as top level community.
Thus it is better to wait if you can :-(
I expect IBM to extend the implementation of Community and related classes by a parent community URL field. What I am curious about is how they will deal with the fact that the complete Atom feed URL is required, including the server address and the parent community UUID. I took the q&d way and changed the community URL as returned by parentCommunity.getCommunityUrl(), but this eventually does not take into account the various AUTH variants.
IBM SBT SDK 1.1.0 of Jul 17, 2014, seems to be out. At least it is available in Maven central.
This is the better answer of course but will require several code adjustments if you have built code on top of internal structures due to some internal refactorings.

Common settings file for multiple projects in a solution

Visual Studio project structure - https://www.box.com/s/np59x20f939n3z1g5dvc
I have multiple projects A, B, etc. that have load tests (which in turn call respective web tests) and a settings file separately for each one of them. I am using these settings files to store the info about web servers.
[Settings.xml]
<?xml version="1.0" encoding="utf-8" ?>
<AppSettings>
<WebServer>www.abc.com</WebServer>
<Proxy></Proxy>
</AppSettings>
I am adding this xml file as a data source in the web test as shown here https://www.box.com/s/53vy0ryvye53m76abuun
Project C has a load test that calls upon web tests from other projects (I am only referring to the projects A, B, etc. here). The setting file for project C looks like this.
<?xml version="1.0" encoding="utf-8" ?>
<AppSettings>
<WebServer>www.SomeOtherWebsite.com</WebServer>
<Proxy></Proxy>
</AppSettings>
I want this settings file to be used for running the Loadtest-C i.e. this settings file has to override the individual settings file from each project.
I want to run LoadTest-C sometimes and LoadTest-A or LoadTest-B sometimes. So, I don’t want to change the individual settings files everytime.
Is there a way I can achieve this?
I found using xml files to be the simpler way. But, please do suggest me if there is a better way.
I have searched online and the only thing I found relevant was this - common Settings.settings file for entire solution. I have a lot of projects similar to A, B, etc. and I don’t want to change the links in each and every project as suggested in the answer there.
[I have never tried coded web tests. So I am not sure if that approach works.]
[and i am relatively new to performance testing]
I have found a solution for this. Instead of using the Settings.xml file, I am adding the entries in that xml file as context parameters to the load test and eliminating the use of data source in individual web tests. So when I run the web test, the parameter it has for web server name is being supplied by the context parameter in the load test.
This might not be the best solution, but this seems to work for me.

AppHarbor Web.config transforms not being applied

I am developing an application in ServiceStack and am trying to sort out deployment on AppHarbor, however for some reason my web.config transforms are not being applied.
I had originally a Web.AppHarbor.config file and changed the Environment Setting to "AppHarbor" - once this failed to work after several updates, I gave up and changed the Environment setting to "Release" and copied the desired transformations into the Web.Release.Config file.
App gets deployed OK but config settings do not reflect the values in the transform file (I verify this by login on with twitter and seeing the callback url for Twitter Auth still tries to redirect me to localhost, which is one of the settings I change in my transform file)
I have also tried the transform tester tool and all works as expected.
Manually publishing the web application to a local folder correctly applies the transformations according to the selected configuration
Does anyone have this working? Is there something obvious I'm missing?
Thanks
It sounds like the Web.Release.config file is not included in the build output. You need to set the Build Action attribute to Content to include it in the build output.
You can confirm whether the file is included in the output by downloading the build from the log page.
I stumbled across this post because I was seeing the same lack of action myself. Upon closer inspection (about 15 times that is) of my Web.Release.config I realized one of the nodes in my config file was not marked xdt:Transform="Replace". Unsurprisingly it did nothing when deployed.

ListInstance deployment guid problems

I have a very basic setup, currently, and I'm fairly new to Sharepoint. I followed the walkthrough here to create a Field definition, content type, list definition from the content type, and a list instance from that list definition.
Currently, if I attempt to deploy my feature with everything in it, I get the following error:
Error occurred in deployment step 'Activate Features': Guid should contain 32 digits with 4 dashes (xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx).
The feature doesn't show up in the administration panel, but the list instance is created (but has no fields because the custom content type isn't activated).
If I remove the listinstance from the feature, everything else activates just fine, and if I put the listinstance in a separate feature it still works, but this really all needs to be in one feature and I don't understand why it doesn't work that way. I added a guid to the list instance that was auto generated because I need to reference this list in the rest of the feature's code. This is the list instance's Elements.xml file:
<?xml version="1.0" encoding="utf-8"?>
<Elements xmlns="http://schemas.microsoft.com/sharepoint/">
<ListInstance Title="SurveyModule - SurveyList"
Id="{C0ED4B73-B140-4057-989B-43344CEE921E}"
OnQuickLaunch="TRUE"
TemplateType="10000"
Url="Lists/SurveyModule-SurveyList"
Description="My List Instance">
</ListInstance>
</Elements>
If there are any other code snippets which would be relevant I can post them.
try it without the braces in the id attribute
<?xml version="1.0" encoding="utf-8"?>
<Elements xmlns="http://schemas.microsoft.com/sharepoint/">
<ListInstance Title="SurveyModule - SurveyList"
Id="C0ED4B73-B140-4057-989B-43344CEE921E"
OnQuickLaunch="TRUE"
TemplateType="10000"
Url="Lists/SurveyModule-SurveyList"
Description="My List Instance">
</ListInstance>
</Elements>
if it still doesn't work, generate a new GUID using: Visual Studio - Tools - Generate GUID (Registry)

Resources