I have a browse screen in LightSwitch Html that lists Requests.
Each of these Requests contains a list of People.
This is a many to many relationship between People and Requests, done using a RequestPerson table.
On the screen I would like to display each Request line with a list of its People.
Request 1
Person1
Person3
Request 2
Person2
Person3
I tried adding a data item of People to the screen, by clicking the addPeople link in the Request data item, and adding it to each Request's row in the list, but this simply creates duplicate lists of the People in the selected row. I want each People list to be a list of People in the Request it belongs to.
Can anyone make any suggestions as to how I can achieve this?
I found the answer here:
http://social.msdn.microsoft.com/Forums/vstudio/en-US/506ea3fc-f352-4858-9983-83f6b865129a/lists-in-lists?prof=required
Needs ajax calls for each sub-list, but it works.
Related
I want delete all items in restful api,I already searched but didn't find anything good
I can delete items with id parameter but I need to clear all of them
Are there anyway to delete all of the items, not deleting items with id one by one
Are there anyway to delete all of the items, not deleting items with id one by one
In HTTP, the semantics of a request apply only to the target-uri; so there isn't any way, for example, to craft a DELETE request that targets multiple resources.
But: there's no rule that each and every row in your database has to have its own dedicated resource, or that all changes to a given row in the database must pass through a single specific resource.
For instance, imagine a web page that lets you delete things. It might look like a bit list, with check boxes next to each item. You select the ones you want to get rid of, click the submit button, and a POST request arrives at the server, which looks at the contents of the request and makes the corresponding changes to the database. That is a perfectly normal REST pattern that we've been using on the web for 25 years.
I'm looking at some code which has broken the saving of changes of a List item in SP2010. In the constructor of the Event Receiver the HttpContext is being stored as a local variable then in the ItemUpdating at the end a query parameter containing the return url is retrieved and passed the SPUtility.Redirect(...). This has the effect of canceling any changes that were made in the edit form. So following so scenarios I've found online I'm storing the HttpContext as a static class object and redirecting in the ItemUpdated event and edits are now persisted followed by a redirect to where we are expecting.
I have a concern though with storing a specific user's HttpContext as a static on a class which will potentially be hijacked if another user does the same action between the time user 1 sets the context initially and prior to the redirect. User 2 will overwrite the context and there are potential issues.
The only other option I can think of as a quick way out would be to store a static Dictionary where the key is the user id then remove the entry just prior to redirecting so as to not leave stray HttpContext instances leaking.
So looking at the accepted solution from here the first response by servy42 states The fact that it works for a few trivial test cases at first doesn't make it a viable solution. but doesn't suggest a viable solution.
There's another option best approach may be changing Save Button in ribbon such that when clicked, a ECMA script first save your Item, then redirect to other page, or open other page in dialog. suggested further down but is that the only other way to go?
I'm fairly new to SP and just trying to navigate through the wealth of wrong ways of doing things with my limited knowledge, whilst unfortunately being stuck with SP2010.
Any thoughts on how to go about this?
============
Edit: Further info as requested
So there are two sites one say called A which will have a sub site called B. A has a List and adding an item to that list triggers event receivers which creates sub site B and other related stuff. If I modify the B "item" from the SharePoint list of Bs then I don't need to redirect and returning to the list is fine. If I'm looking and a neatly rendered Gantt chart on A listing the Bs the if I edit B after clicking Save we need to come back to A. If I'm on B there's an edit button as well so I want to return to B after editing and clicking save.
So we have the source= appended when we go to the edit screen. From some reading I've done it seems SharePoint will pick that up and redirect. One of the fields on the edit page is the relative url beneath the A site and if that changes then the redirect url will no longer be valid and throw a 404 so we replace the old B sub path with the newly entered value. But we then need code to redirect to the new location.
I am not quite sure whether i understand your requirements correctly. But i will give it a try. Just a quick summary of what i understood (correct me if i am wrong...):
You have a Root Web in a site collection with a list
Each entry in that list corresponds to a subsite which will be created on List Item creation (ER) below the Root Web as a subsite
List items can be edited from both the List in the root web as well as from the subsite it maps to
On editing from the subsite you want to return to the subsite after saving
My approach would be this:
Follow the steps described in this article SP Dialog and List Forms
Open a dialog on the subsite that links to the edit form of the root web.
After saving the user finds himself already where he should be
Hope this helps... Cheers!
Edit: Just read the requirement about changing of url. Create a custom Edit Form which you enhance with some js that passes values back to the origin site -> Parameters in dialogs. You may then react accordingly in the javascript callback and redirect to the new url.
I would like to set up a (Google) form-filling system, that essentially has to be accessed and filled two times (before and after the completion of a project). I would like to create a form one can return to by filling in an ID number.
For that, I would need a script that automatically generates an ID number for each respondent. I have found 'Google Apps Script for Form, Generate Unique ID Number', but I couldn't get it to work (I am not good at scripting yet). I would like to be able to decide how the ID numbers are generated (for example to have non-numeric characters as well, e.g. XYZ000000001, XYZ00000002, XYZ00000003, etc.)
The reason I want to do this is so that respondents can access their own responses based on the ID assigned to Them. I found two possible solutions, but again, I can't manage them. One code is the 'Class FormResponse' that fetches the existent information (if I understand it well enough), and the other is 'Generate unique Form URL for each respondent' which generates a unique URL for each respondent. That would work fine, but I still need the IDs for easier data maintenance.
This is a lot of code and I'm not sure if it makes sense to combine all of it. Perhaps there is an easier way to achieve what I want with a way simpler script. I will break down the process as I imagine it, into steps:
Send a form to AA#zive.com,BB#zive.com,CC#zive.com.
For example, BB only has a project planned, so BB receives the form which asks: Is Your project planned or completed?
BB chooses the first option and fills in the details.
BB gets a unique ID which is inserted into the first column of the responses.
The ID is sent back in a response email to BB (perhaps the linked script can be tweaked to send the unique ID).
After a couple of months, BB has completed the project, so BB goes back to the form, either via the same email sent in step 1, or the same form embedded on a website.
BB now chooses the second option, since the project is completed.
The form asks for the ID number, BB fills it.
All of BB's answers now go to the row with the matching ID, overwriting certain fields if necessary...
I am aware that this might be a bit complex, but any even partial answer accompanied by some snippets of code would be highly appreciated. I will gladly share it once I manage to compile the whole idea. :)
Google Forms doesn't allow respondents to search previous sent responses. The only way that they can access a previously submitted response is by the edit response URL. To get this URL programmatically, use getEditResponseUrl.
You could send this URL by an email. For details see How to add "Edit Response" link to Google Forms emails?
When I GET from http://example.com/organization/ I get a list of organizations.
When I GET from http://example.com/organization/xyz/ I get the record for the organization xyz.
When I POST form data to http://example.com/organization/ I create a new organization.
What URL should I use to GET a form to fill out to create a new organization via a POST to http://example.com/organization/?
Looking at How to do a RESTful request for an edit form? and other sources, it would seem that I am really looking for a form resource for organizations -- so I should GET that form at something like http://example.com/organization/form/ and POST to http://example.com/organization/ as described above. This seems...untidy though.
Update
tuespetre's comments have me thinking the best way to do this is to have a form resource. The organziation form is provided via a GET to /form/organization/ which is filled out and posted to /organization/.
A form in the sense that you speak of one is not a resource, but a template to gather user input to POST a new resource.
One really 'RESTful way' to do it would be to utilize some Javascript to 'include' that form in the collection page /organizations, either as a hidden 'slide-down' form or maybe a modal dialog that appears when a certain call to action button is pressed. This would make semantic sense for two reasons:
You won't have to have some arbitrary URI being used for the form (which is not really a resource in the sense that your domain objects are), and
the 'create' form is for POSTing to the collection, so it really closely relates to that collection and thus would not be at all out of place to have right there with the collection.
Of course, you will find many opinions on this, but I would rather not have arbitrary URIs that break the established pattern (i.e., you're not getting an organization with an id of 'new', so why have that inconsistency?)
If you're trying to implement it, I've seen it done in different ways and I don't think there's a rule (but there are different patterns/approachs that you could follow or not).
I would make it http://example.com/organization/new/
I'm new to programming Facebook apps, so please forgive my ignorance and my use of non-formal terms.
There is an option on Facebook to create mixed lists of friends, liked-pages, and subscriptions so that you can see a "custom feed" containing posts only from the members of the list.
If a user is subscribed to such a list, can my app access the "custom feed"? Or at least the array of members of this list? (which I can then iterate through and fetch the posts published by these members)
I've read about the FriendList object of the Graph API, but when I tested it on myself with This Link (sources: Graph API, FriendList), it didn't show all of my created lists, but only those that are strictly defined as "friend lists" - i.e. lists containing only friends (and not liked-pages or subscriptions).
But I've noticed three things-
On my homepage the "friend-lists" (those that do appear in the above link) have a different icon (a little blue person) than the "mixed-lists" (a blue square with an "rss-wave" icon)
All of my "friend-lists" are old lists which I have created a few years ago. The newer lists are "mixed-lists". I can tell the difference both by the icon and the fact that the new lists don't appear in the above link.
When I added a liked-page to one of my "friend-lists" it did not change its type (same icon and still appears in the above link).
Which leads me to these questions-
What is the difference between these types of lists?
And for that matter how many types of lists are there? Are they managed differently?
How can my app access these "mixed-lists"? I want a list of all the lists the user is subscribed to, and I want my app to be able to read the posts published on these lists.
I hope that was clear enough.
Thanks!
EDIT:
I noticed another big difference between these types of lists: the "friend-lists" show up under the "Friends" headline on the left side menu (when you press "more" you can see all of them). The "mixed-lists" as I called them show up under the "Interests" headline. So this must be the difference. I think they are pretty much the same as far as what types of members you can add to the list. The difference must be that "friend-lists" are only for the user who created them, while "interest-lists" (a.k.a "mixed-lists") can be published and subscribed to by other people.
I'll try to find documentation about "interest-lists". If anyone already knows the answer please share :)
I just tested it ā created a list, added one of my friends and one of the pages Iām a fan of to it.
It shows up in the Graph API explorer with "list_type": "user_created" ā but /listid/members only shows the friend I put onto that list, not the page.
This is consistent with what the docs say on the members connection,
members: All of the users who are members of this list.
So there currently seems to be no way to get info about pages on such lists. (Anybody knows something different, they might correct me.)